Created
October 24, 2017 22:52
-
-
Save scheib/f379c01844c1e06e73f9dafeb69c2d1d to your computer and use it in GitHub Desktop.
Revisions
-
scheib created this gist
Oct 24, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ function setLed(n) { LED1.write(n === 1); LED2.write(n === 2); LED3.write(n === 3); } function blinkCount(n) { if (n === 0) { n = 5; } var led = 0; var count = n; var interval = setInterval(function() { led = (led + 1) % 4; setLed(led); if (led === 0) { count -= 1; } if (count === 0) { clearInterval(interval); setTimeout(function() { blinkCount(n - 1); }, 1000); } }, 200); } blinkCount(0);