Last active
September 16, 2015 03:24
-
-
Save myconode/67f9b3f0ab97d6d05516 to your computer and use it in GitHub Desktop.
Tessel Delay
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
// Tessel Delay | |
// Author: Daniel Christopher <[email protected]> | |
// Public Domain | |
// | |
// Halt script execution for given number of microseconds. | |
// Inspired by Arduino's built-in delay(). | |
// | |
// Those already working with Javascript are likely to use setTimeout. | |
console.log("\nDoing something..."); | |
delay(2000); | |
console.log("...continue doing something\n"); | |
// End program | |
return; | |
// - lite version of [ErikDubbelboer's sleep](github.com/ErikDubbelboer/node-sleep) | |
function delay(ms){ var e = new Date().getTime() + (ms); while (new Date().getTime() <= e){ ; } ; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment