added json parsing

This commit is contained in:
sam
2023-10-11 16:47:39 +02:00
parent 65b0c13a86
commit a076c49dd2

View File

@@ -4,7 +4,7 @@ let reader;
let decoder = new TextDecoder("utf-8"); let decoder = new TextDecoder("utf-8");
let counterElement = document.getElementById("counter"); let counterElement = document.getElementById("counter");
let readibleoutput = 0; let readibleoutput = 0;
let temp = 0; let tempArray = [];
let humid = 0; let humid = 0;
let licht = 0; let licht = 0;
@@ -47,8 +47,10 @@ async function readLoop() {
if (SensorValues) { if (SensorValues) {
console.log(SensorValues) console.log(SensorValues)
tempArray.push(SensorValues[0])
} }
console.log(sensorString);
buffer = []; buffer = [];
// var array = sensorString.split(','), // var array = sensorString.split(','),
// temp = array[0], humid = array[1], licht = array[2]; // temp = array[0], humid = array[1], licht = array[2];
@@ -74,8 +76,6 @@ async function readLoop() {
// Close the port // Close the port
async function disconnect() { async function disconnect() {
await reader.cancel(); await reader.cancel();