master
louisa 1 year ago
parent e1d05dfeb5
commit 2b49b08931

@ -10,7 +10,6 @@ var port = 8000;
const { SerialPort } = require('serialport')
const { ReadlineParser } = require('@serialport/parser-readline')
const sport = new SerialPort({ path: '/dev/ttyACM0', baudRate: 115200 })
const parser = sport.pipe(new ReadlineParser({ delimiter: '\r\n' }))
parser.on('data', console.log)

@ -18,11 +18,9 @@
// Split the data into separate parts
const [node, value] = data.split(' ');
if (node === 'node4' && value === '21') {
// Change the background color to red
document.body.style.backgroundColor = 'red';
} else {
if (node === 'node3' && value === '15'){
document.body.style.backgroundColor = 'red';}
else {
// Restore the default background color
document.body.style.backgroundColor = 'white';
}

Loading…
Cancel
Save