diff options
Diffstat (limited to 'code')
-rw-r--r-- | code/001-blink.js | 5 | ||||
-rw-r--r-- | code/002-button.js | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/code/001-blink.js b/code/001-blink.js new file mode 100644 index 0000000..408aeb4 --- /dev/null +++ b/code/001-blink.js @@ -0,0 +1,5 @@ +var on = false; +setInterval(function() { + on = !on; + LED1.write(on); +}, 500);
\ No newline at end of file diff --git a/code/002-button.js b/code/002-button.js new file mode 100644 index 0000000..e98ace2 --- /dev/null +++ b/code/002-button.js @@ -0,0 +1,7 @@ +var on = false; +var change = function() { + on = !on; + LED1.write(on); + }; + +setWatch(change, BTN1, {repeat:true, edge:"rising"});
\ No newline at end of file |