diff --git a/web/main.js b/web/main.js index dad1607..ff372a0 100644 --- a/web/main.js +++ b/web/main.js @@ -1,9 +1,13 @@ +// Description: Main JavaScript file for the web application. +// arrays and stuff const sensorData = {}; -let intervalDelay = 5000; -// Create WebSocket connection. -const socket = new WebSocket("ws://145.92.8.114/ws"); let liveGraphs = []; +// variables +let intervalDelay = 5000; +let amountOfNodes = 4; + +const socket = new WebSocket("ws://145.92.8.114/ws"); function openConnection() { // Open connection socket.addEventListener("open", (event) => { @@ -192,7 +196,7 @@ function updateNodeData(node, temperature, humidity, eCO2, TVOC) { } // Call the function to create the HTML structure -for (let i = 1; i <= 4; i++) { +for (let i = 1; i <= amountOfNodes; i++) { createNodeData(i); liveGraphs.push(new liveGraph(i)); }