diff --git a/docs/brainstorm/SoftwareDocumentatie/Dev_page.md b/docs/brainstorm/SoftwareDocumentatie/Dev_page.md index 138990e..6d75aca 100644 --- a/docs/brainstorm/SoftwareDocumentatie/Dev_page.md +++ b/docs/brainstorm/SoftwareDocumentatie/Dev_page.md @@ -2,15 +2,17 @@ ### parsing JSON +The data that is send by the nodes is send in json data. We chose this becouse we can easily use the data within javascript, this is called parsing. We use the parced data and send that in to the next function to make the data more acceseble to use in further instences. + ```js const jsonData = JSON.parse(event.data); // Use the parsed JSON data as needed handleIncomingData(jsonData); ``` -### Pro - +Here is the function that receves the parced JSON data and set it into variables. +```js function handleIncomingData(data) { nodeNumber = data.node; temperature = data.Temp; @@ -20,7 +22,7 @@ function handleIncomingData(data) { processNodeData(nodeNumber, temperature, humidity, CO2, TVOC); } - +``` function processNodeData(nodeNumber, temperature, humidity, CO2, TVOC) { // Initialize the array for this node if it doesn't exist yet if (!sensorData[nodeNumber]) {