|
|
|
@ -6,11 +6,12 @@ var path = require('path');
|
|
|
|
|
var server = http.createServer(app);
|
|
|
|
|
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);
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
server.listen(port, () => {
|
|
|
|
|
console.log("Server is listening at port %d", port);
|
|
|
|
|