Tuesday, 1 January 2019

Node.js Express Server communicating with Arduino via 'node-serialport'. How to send reveived text to the webpage to get status updates?

Hey all and a happy new year!​I am running a Node.js webserver (currently on my local desktop pc) unsing 'express'. The webserver serves as an controll interface for an arduino. The communication between those two is realised via serialport using 'node-serialport'. Basically I am sending Strings to the arduino's serialport as commands. I also can send text from the arduino to the server. I would like to use this, to manipulate my webpage to show some status updates. I think about something like changing a

or a

.I do not really know where to start so I just tried to use the 'on data' emitted event by the serialport module to reload the page but this didnt work.In app.js tried the following:arduino.on('data', function (data) { console.log(data.toString()); // this works res.render('index'); // this does not work }); How is it possible to send text, received from the arduino, to the interface to get status updates?​

Submitted January 01, 2019 at 07:45PM by cablefromthematrix

No comments:

Post a Comment