Ejemplo n.º 1
0
function light(blink) {
    if (blink > 4000) {
        blink1.setRGB(255,0,0);
    } else {
        blink1.setRGB(0, 255, 0);
    }
}
Ejemplo n.º 2
0
function cancel() {
  if (typeof pulse !== 'undefined' && typeof schdl !== 'undefined') {
    pulse.clear();
    schdl.cancel();
  }
  blink1.setRGB(0, 0, 0);
}
Ejemplo n.º 3
0
// cleanup
function exitHandler(options, err) {
    if (err) {
        console.log(err.stack);
        process.exit();
    } else {
        console.log("closing");
        blink1.setRGB(0, 0, 0, function() {
            process.exit();
        });
    }
}
Ejemplo n.º 4
0
 setInterval(function() {
     //blink1.fadeToRGB(10, r, 0, b);
     blink1.setRGB(r, 0, b);
     if (rbbr === "rb") {
         r -= 255;
         b += 255;
         if (b === 255) {
             rbbr = "br";
         }
     } else {
         r += 255;
         b -= 255;
         if (r === 255) {
             rbbr = "rb";
         }
     }
 }, 100);
Ejemplo n.º 5
0
router.post('/Blink/editOff', function (req, res, next) {
  //cancel();
  blink1.setRGB(150, 0, 0);
  res.status(200).redirect('/');
});
Ejemplo n.º 6
0
var Blink1 = require('node-blink1')
blink = new Blink1()
blink.setRGB(225, 0, 0)
Ejemplo n.º 7
0
'use strict'

const Blink1 = require('node-blink1')
const Client = require('ibmiotf')

const COLOURS = {
  "red":"#FF0000", "green":"#00FF00", "blue":"#0000FF", "cyan":"#00FFFF",
  "white":"#FFFFFF", "warmwhite":"#FDF5E6", "oldlace":"#FDF5E6",
  "purple":"#800080", "magenta":"#FF00FF", "pink":"#FF69B4",
  "yellow":"#FFFF00", "amber":"#FFD200", "orange":"#FFA500",
  "black":"#000000", "off":"#000000"
}

var blink1 = new Blink1()
blink1.setRGB(255, 255, 255)
blink1.fadeToRGB(1000, 0, 0, 0)

/**
 * You need to register your devices through IBM Bluemix's
 * IOT service (https://internetofthings.ibmcloud.com) and 
 * fill in the authentication details here...
 */
const config = {
  "org" : "",
  "id" : "blink1",
  "type" : "blink1",
  "auth-method" : "token",
  "auth-token" : ""
}

function connectToBroker(config) {