hybridgroup/cylon-sphero

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

Summary

Maintainability
A
1 hr
Test Coverage
"use strict";

var Cylon = require("cylon");

var bots = [
  { name: "Thelma", port: "/dev/rfcomm0" },
  { name: "Louise", port: "/dev/rfcomm1" }
];

bots.forEach(function(bot) {
  Cylon
    .robot({ name: bot.name })
    .connection("sphero", { adaptor: "sphero", port: bot.port })
    .device("sphero", { driver: "sphero" })
    .on("ready", function(robot) {
      setInterval(function() {
        console.log(robot.name);
        robot.sphero.randomColor();
        robot.sphero.roll(60, Math.floor(Math.random() * 360));
      }, 1000);
    });
});

Cylon.start();