Created
November 30, 2015 11:16
-
-
Save shundroid/8e0f4d380e27374df931 to your computer and use it in GitHub Desktop.
初めてのSphero (node.js)
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
"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