Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- //var five = require("johnny-five");
- var instapush = require("instapush");
- var serialport = require("serialport");
- var SerialPort = require("serialport").SerialPort;
- //var board = new five.Board();
- //var interval = 10000;
- //var botToken = 'xoxb-7654433348-NqFvmEsxjgT6OifKVNM3NObE';
- //var ledIndex = process.argv[2] || 13;
- var insta_conf = {
- id: '**',
- secret: '**',
- token: '**'
- };
- //board.on("ready", function () {
- instapush.settings({
- id: insta_conf.id,
- secret: insta_conf.secret,
- token: insta_conf.token
- });
- var notify = function (user, text) {
- instapush.notify({
- "event": "io",
- "trackers": {
- "user": user,
- "text": text
- }
- }), function (err, response) {
- console.log(err, response);
- };
- },
- serialPort = new SerialPort("/dev/tty.usbmodem1451", {
- baudrate: 9600,
- parser: serialport.parsers.readline("\n")
- });
- serialPort.on('open', function () {
- console.log('open');
- serialPort.on('data', function (data) {
- if (data) {
- if (data.indexOf('user') >= 0) {
- var user = data.split(':')[1];
- notify(user, "checked in");
- }
- }
- });
- });
- //});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement