Created
February 14, 2019 20:56
-
-
Save netomarin/182916e8f8e237635df124726913029a to your computer and use it in GitHub Desktop.
Basic Sphero connection demo using their JavaScript API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sphero = require("sphero"), | |
sprk = sphero("EA:FE:34:55:2A:E0"); // change BLE address accordingly | |
sprk.connect(function() { | |
// roll Sphero in a random direction, changing direction every second | |
setInterval(function() { | |
var direction = Math.floor(Math.random() * 360); | |
sprk.roll(150, direction); | |
}, 1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment