|
|
@ -6,11 +6,12 @@ var path = require('path');
|
|
|
|
var server = http.createServer(app);
|
|
|
|
var server = http.createServer(app);
|
|
|
|
var port = 8000;
|
|
|
|
var port = 8000;
|
|
|
|
|
|
|
|
|
|
|
|
const { SerialPort } = require('serialport');
|
|
|
|
const { SerialPort } = require('serialport')
|
|
|
|
const { ReadlineParser } = require('@serialport/parser-readline');
|
|
|
|
const { ReadlineParser } = require('@serialport/parser-readline')
|
|
|
|
const sport = new SerialPort({ path: '/dev/ttyACM0', baudRate: 115200 });
|
|
|
|
const sport = new SerialPort({ path: '/dev/ttyACM0', baudRate: 115200 })
|
|
|
|
const parser = sport.pipe(new ReadlineParser({ delimiter: '\r\n' }));
|
|
|
|
|
|
|
|
parser.on('data', console.log);
|
|
|
|
const parser = sport.pipe(new ReadlineParser({ delimiter: '\r\n' }))
|
|
|
|
|
|
|
|
parser.on('data', console.log)
|
|
|
|
|
|
|
|
|
|
|
|
server.listen(port, () => {
|
|
|
|
server.listen(port, () => {
|
|
|
|
console.log("Server is listening at port %d", port);
|
|
|
|
console.log("Server is listening at port %d", port);
|
|
|
|