I'm currently using a pulse sensor on an arduino, and trying to get data from the sensor and trying to display it on the browser. This is what my nodejs code looks like.
var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("/dev/cu.usbserial-DA011OXR", {
baudrate: 57600
});
serialPort.on('open', showPortOpen);
serialPort.on('data', saveLatestData);
serialPort.on('close', showPortClose);
serialPort.on('error', showError);
function showPortOpen() {
console.log('port open. Data rate: ' + serialPort.options.baudRate);
}
function showPortClose() {
console.log('port closed.');
}
function showError(error) {
console.log('Serial port error: ' + error);
}
function saveLatestData(data) {
console.log(data);
latestData = data;
}
And this is the kind of data I'm getting on the terminal.
<Buffer 53 35 31 34 0d 0a>
<Buffer 53 35 31 33 0d 0a>
<Buffer 53 35 31 31 0d 0a>
<Buffer 53 35 31 30 0d 0a>
<Buffer 53 35 31 31 0d 0a>
<Buffer 53 35 31 31 0d 0a>
<Buffer 53 35 31 31 0d 0a>
<Buffer 53 35 31 32 0d 0a>
<Buffer 53 35 31 32 0d 0a>
<Buffer 53 35 31 33 0d 0a>
<Buffer 53 35 31 34 0d 0a>
<Buffer 53 35 31 34 0d 0a>
<Buffer 53 35 31 34 0d 0a>
<Buffer 53 35 31 34 0d 0a>
<Buffer 53 35 31 34 0d 0a>
<Buffer 53 35 31 33 0d 0a>
<Buffer 53 35 31 32 0d 0a>
<Buffer 53 35 31 31 0d 0a>
I've been trying to look on the web how I should interpret or parse this data, but I'm pretty clueless. Any help would be great!