The official Orbotix JavaScript SDK module to programatically control Sphero robots.

$ npm install sphero

To initialize and connect to a Sphero:

var sphero = require("sphero"),
    orb = sphero("/dev/rfcomm0");
orb.connect(function() {
  // Sphero's connected! 
  // do some cool stuff here! 

Once connected, you can give Sphero commands:

orb.connect(function() {
  // roll Sphero forward 
  orb.roll(150, 0);
  // turn Sphero green 
  // have Sphero tell you when it detect collisions 
  // when Sphero detects a collision, turn red for a second, then back to green 
  orb.on("collision", function(data) {
    console.log("collision detected");
    console.log("  data:", data);
    setTimeout(function() {
    }, 1000);

For more examples, check out the examples dir, or the JavaScript SDK documentation on the Sphero developer portal.

Use npm install to install development dependencies.

You can run tests with grunt test.

Using grunt lint to run ESLint against both lib and spec/lib.

The grunt command will run both of the above tasks.

Copyright (c) 2015 Orbotix. MIT Licensed. For more details, see the LICENSE file.