Portname in linux for NodeJS
in Cyton
Hey guys,
New to the OpenBCI world, so please forgive the newbie question.
I've got the Cyton board up and running, and I'm seeing ECG data on the GUI... heart rate is coming through great.
I'm now trying to get access to the signal data through NodeJS (following the youtube video: https://www.youtube.com/watch?v=jcYXFc4geoM)
I just cannot seem to get the portname to have my code find the board. I'm running linux and see the board as "/dev/ttyUSB0" - validated in the GUI.
Here's my code and below that is what I'm seeing in the log:
const Cyton = require('./node_modules/openbci-cyton');
const ourBoard = new Cyton(
{
verbose: true //debug: true
}
);
var portName="/dev/ttyUSB0";
ourBoard.connect(portName).then(connection_success, connectbad);
function connection_success(portName) {
console.log('board found on ', portName);
ourBoard.on('ready', function() {
ourBoard.streamStart().then(null,null);
ourBoard.on('sample', function (sample) {
console.log('heard something');
console.log(sample.channelData[0])
});
});
}
function connectbad () {
console.log('no board found');
}
/usr/local/bin/node --inspect-brk=42260 project.js
Debugger listening on ws://127.0.0.1:42260/769dd8f8-7b86-4567-97af-a11f2aa43071
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
using real board /dev/ttyUSB0
Serial port connected
no board found
Comments