Created
February 22, 2015 04:27
-
-
Save bathtimefish/11e72aae5c82009333f3 to your computer and use it in GitHub Desktop.
TesselのGPIOでLチカする
This file contains hidden or 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
/* | |
* TesselのGPIOでLチカ | |
* LEDのアノードをTesselの TX/G1 | |
* LEDのカソードをTesselの GND | |
* に接続する | |
*/ | |
var tessel = require('tessel'); | |
var gpio = tessel.port['GPIO']; | |
gpio.digital[0].write(0); // TX/G1 | |
flag = true; | |
setInterval(function() { | |
if(flag == true) { | |
flag = false; | |
} else { | |
flag = true; | |
} | |
console.log(flag); | |
if(flag) gpio.digital[0].write(1); | |
if(!flag) gpio.digital[0].write(0); | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment