Skip to content

Commit

Permalink
additional necessary changes for serialport to work
Browse files Browse the repository at this point in the history
  • Loading branch information
jellomoat committed May 5, 2022
1 parent ba4fc63 commit 11f02b3
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 12,447 deletions.
2 changes: 1 addition & 1 deletion day2/01-button-serial/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ parser.on('data', data => {
} else {
console.log("NOT PRESSED");
}
});
});
8 changes: 4 additions & 4 deletions day2/01-button-sockets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const PORT = 3000;
const server = require('http').createServer(app);
const io = require('socket.io')(server);

const SerialPort = require('serialport');
const Readline = require('@serialport/parser-readline');
const sPort = new SerialPort('/dev/cu.usbmodem141101', { baudRate: 9600 });
const parser = sPort.pipe(new Readline({ delimiter: '\n' }));
const { SerialPort } = require('serialport');
const { ReadlineParser } = require('@serialport/parser-readline');
const sPort = new SerialPort({ path: '/dev/cu.usbmodem14101', baudRate: 9600 });
const parser = sPort.pipe(new ReadlineParser({ delimiter: '\r\n' }));


io.on('connection', function (socket) {
Expand Down
3,410 changes: 0 additions & 3,410 deletions day2/01-button-sockets/package-lock.json

This file was deleted.

1 change: 0 additions & 1 deletion day2/01-button-sockets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"dependencies": {
"express": "^4.16.4",
"nodemon": "^1.19.3",
"serialport": "^7.1.5",
"socket.io": "^2.2.0"
}
}
8 changes: 4 additions & 4 deletions day2/02-knob/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const PORT = 3000;
const server = require('http').createServer(app);
const io = require('socket.io')(server);

const SerialPort = require('serialport');
const Readline = require('@serialport/parser-readline');
const sPort = new SerialPort('/dev/cu.usbmodem141101', { baudRate: 9600 });
const parser = sPort.pipe(new Readline({ delimiter: '\n' }));
const { SerialPort } = require('serialport');
const { ReadlineParser } = require('@serialport/parser-readline');
const sPort = new SerialPort({ path: '/dev/cu.usbmodem14101', baudRate: 9600 });
const parser = sPort.pipe(new ReadlineParser({ delimiter: '\r\n' }));


io.on('connection', function (socket) {
Expand Down
Loading

0 comments on commit 11f02b3

Please sign in to comment.