Hi All,
var b = context.global.octalbonescript;
b.serial.open('/dev/ttyO2', {baudRate: 115200}, function(data){
console.log(data);
}, function(err){
if(err){
console.error(err.message);
}
});
var path='/dev/ttyO2';
//msg.payload is passed from the previous block as "hello World"
var buffer = msg.payload +'\r';
b.serial.write(path, buffer);
return msg;
Now, I want to try and get the serial read working, but I don't fully understand the operation and wondered if anyone can help (an example would be tops). The documentation defines the serial.open as:
serial.open(path, options, handler[data], callback[err|null, serialPort])
so I take it that the incoming serial data is passed into the handler[data]. Do I need to keep calling this function to check for any data or do I just do it once and it gets handled in the background??
Best regards
Michael