Skip to content

Instantly share code, notes, and snippets.

@shundroid
Created November 30, 2015 11:16
Show Gist options
  • Save shundroid/8e0f4d380e27374df931 to your computer and use it in GitHub Desktop.
Save shundroid/8e0f4d380e27374df931 to your computer and use it in GitHub Desktop.
初めてのSphero (node.js)
"use strict";
var sphero = require("sphero");
var orb = sphero("<ポート名>");
orb.connect(listen);
var isRed = false;
function listen() {
orb.color("green");
setInterval(function() {
if (isRed) {
orb.color("red");
} else {
orb.color("green");
}
isRed = !isRed;
}, 1000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment