Does anyone have some sample code to use the node.js serialport module in a blocking / synchronous way?
What I'm trying to do is send a command to the microcontroller and wait for a response before sending the next command.
Sending / receiving works for me, but the data just enters the list of listeners
serial.on( "data", function( data) {
console.log(data);
});
Is there any way to wait for returned data after execution
serial.write("Send Command");
Should I set a global flag or something else?
I'm still new to node.js asynchronous programming style
thank
source
share