Skip to content

Instantly share code, notes, and snippets.

@myconode
Last active September 16, 2015 03:24
Show Gist options
  • Save myconode/67f9b3f0ab97d6d05516 to your computer and use it in GitHub Desktop.
Save myconode/67f9b3f0ab97d6d05516 to your computer and use it in GitHub Desktop.
Tessel Delay
// Tessel Delay
// Author: Daniel Christopher <thelostspore@gmail.com>
// 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