Skip to content

Instantly share code, notes, and snippets.

@ben-bradley
Created June 5, 2015 21:33
Show Gist options
  • Save ben-bradley/6ec89192a2ad4a043ade to your computer and use it in GitHub Desktop.
Save ben-bradley/6ec89192a2ad4a043ade to your computer and use it in GitHub Desktop.
sphero.js
var Cylon = require('cylon');
Cylon.robot({
connections: {
sphero: { adaptor: 'sphero', port: '/dev/tty.Sphero-RPG-AMP-SPP' }
},
devices: {
sphero: { driver: 'sphero' }
},
work: function(my) {
every((5).second(), function() {
let speed = 60,
heading = Math.floor(Math.random() * 360);
console.log('speed:', speed, 'heading:', heading);
my.sphero.roll(speed, heading);
});
}
}).start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment