hybridgroup/cylon-intel-iot

View on GitHub
examples/blinkm/fluent-blinkm.js

Summary

Maintainability
C
1 day
Test Coverage
"use strict";

var Cylon = require("cylon");

Cylon
  .robot()
  .connection("edison", { adaptor: "intel-iot" })
  .device("blinkm", { driver: "blinkm" })
  .on("ready", function(bot) {
    bot.blinkm.stopScript();

    bot.blinkm.getFirmware(function(err, version) {
      if (err) { console.error(err); }
      console.log("Started BlinkM version " + version);
    });

    bot.blinkm.goToRGB(0, 0, 0);

    bot.blinkm.getRGBColor(function(err, data) {
      if (err) { console.error(err); }
      console.log("Starting Color: ", data);
    });

    every((2).seconds(), function() {
      bot.blinkm.getRGBColor(function(err, data) {
        if (err) { console.error(err); }
        console.log("Current Color: ", data);
      });

      bot.blinkm.fadeToRandomRGB(128, 128, 128);
    });
  });

Cylon.start();