Skip to content

Instantly share code, notes, and snippets.

@tom-a
Last active March 16, 2019 16:29
Show Gist options
  • Save tom-a/2ce5e7f8647f2433bb17916ba4dcb3b4 to your computer and use it in GitHub Desktop.
Save tom-a/2ce5e7f8647f2433bb17916ba4dcb3b4 to your computer and use it in GitHub Desktop.
const ambient = require('ambient-lib');
const exec = require('child_process').exec;
ambient.connect(チャネルID,'ライトキー');
exec("cat /dev/cuaU0 | head -1", (err,stdout,stderr) => {
});
exec("cat /dev/cuaU0 | head -3 | sed '/^$/d' | tail -1", (err,stdout,stderr) => {
console.log(stdout);
ambient.send({d1: stdout}, (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