Trouble with node js serialport.parser and PST...
Copper
Posts: 48
in Propeller 1
I'm having some trouble with node js serialport.parser
I have a dead simple program (HelloPST basically) running on my prop dev board just spitting out "This is a test message!" over and over...
I tried using FullDuplexSerial since PST says in the comments it's "for the parallax serial terminal" (didn't help)...
I tried slowing down the data rate just because...
on the server, the port opens successfully, and if I register a 'data' event with the port I get:
port open.
port data:
port data: T
port data: his
port data: is
port data: a
port data:
port data: te
port data: st
port data:
port data: m
port data: e
port data: s
port data: s
port data: a
port data: g
port data: e
port data: !
port data:
but the parser's 'data' event never fires (should with new line; tried adding '\n' to message just in case, but no effect)...
server code for serial port stuff:
based on Heater's post/thread from 2013
http://forums.parallax.com/discussion/147253/node-js-and-the-propeller
and the node serialport documentation
https://github.com/node-serialport/node-serialport/blob/v6.0.4/README.md
my node js version is v6.11.3
I'm afraid I don't know what to try next... I would appreciate any suggestions...
I have a dead simple program (HelloPST basically) running on my prop dev board just spitting out "This is a test message!" over and over...
''This code example is from Propeller Education Kit Labs: Fundamentals, v1.2. ''A .pdf copy of the book is available from www.parallax.com, and also through ''the Propeller Tool software's Help menu (v1.2.6 or newer). '' ''HelloPST.spin ''Test message to Parallax Serial Terminal. CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ pst : "Parallax Serial Terminal" ''pst : "FullDuplexSerial" PUB TestMessages ''Send test messages to Parallax Serial Terminal. ''pst.Start(115_200) pst.Start(9600) ''pst.Start(31, 30, 0, 115_200) repeat pst.Str(string("This is a test message! \n")) Pst.NewLine waitcnt(clkfreq + cnt)
I tried using FullDuplexSerial since PST says in the comments it's "for the parallax serial terminal" (didn't help)...
I tried slowing down the data rate just because...
on the server, the port opens successfully, and if I register a 'data' event with the port I get:
port open.
port data:
port data: T
port data: his
port data: is
port data: a
port data:
port data: te
port data: st
port data:
port data: m
port data: e
port data: s
port data: s
port data: a
port data: g
port data: e
port data: !
port data:
but the parser's 'data' event never fires (should with new line; tried adding '\n' to message just in case, but no effect)...
server code for serial port stuff:
var serialPort = require('serialport'); var serOptions = { baudRate: 9600, databits: 8, stopbits: 1, parity: 'none', buffersize: 256, encoding: 'utf8' }; const readLine = serialPort.parsers.Readline; const port = new serialPort('/dev/ttyUSB0', serOptions); const parser = port.pipe(new readLine({delimiter: '\r\n'})); parser.on('data', function(data){console.log('parser data: ' + data.toString('utf8'));}); //port.on('data', function(data){console.log('port data: ' + data.toString('utf8'));}); port.on('open', ShowPortOpen); port.on('error', ShowError);
based on Heater's post/thread from 2013
http://forums.parallax.com/discussion/147253/node-js-and-the-propeller
and the node serialport documentation
https://github.com/node-serialport/node-serialport/blob/v6.0.4/README.md
my node js version is v6.11.3
I'm afraid I don't know what to try next... I would appreciate any suggestions...
Comments
pst.Str(string("This is a test message!",10))
Edit: \n = 10, \r=13