Last active
May 5, 2019 02:40
-
-
Save tom-a/0fa41bafcd674ac3afc2c9b9e388f3d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ambient = require('ambient-lib'); | |
const SerialPort = require('serialport'); | |
const port = new SerialPort('/dev/cuaU0'); | |
const Readline = require('@serialport/parser-readline'); | |
const parser = new Readline(); | |
port.pipe(parser); | |
ambient.connect(00000,'xxxxxxxxxxxxxxxx'); | |
parser.on('data', line => { | |
ambient.send({d1: line}, (err, res, body) => { | |
if (err) { console.log(err); } | |
console.log(res.statusCode); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment