Private
Public Access
2
0

Blink-IO.js: Call the function after declaring it

This works ok if executing the whole file but the node.js interactive
interpreter gets confused when yoy copy and paste the code

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2016-01-06 16:37:14 +00:00
parent a87a104efe
commit 0ebab9603e

View File

@@ -29,11 +29,12 @@ var myLed = new m.Gpio(13); //LED hooked up to digital pin 13 (or built in pin o
myLed.dir(m.DIR_OUT); //set the gpio direction to output
var ledState = true; //Boolean to hold the state of Led
periodicActivity(); //call the periodicActivity function
function periodicActivity()
{
myLed.write(ledState?1:0); //if ledState is true then write a '1' (high) otherwise write a '0' (low)
ledState = !ledState; //invert the ledState
setTimeout(periodicActivity,1000); //call the indicated function after 1 second (1000 milliseconds)
}
periodicActivity(); //call the periodicActivity function