Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. async function startProgram() { // start main program as an asynchronous function
  2.  
  3. while (true) { // infinite loop
  4.  
  5. setMainLed({ // set led to blue, let user know game is ready to play
  6. r: 0,
  7. g: 0,
  8. b: 255
  9. });
  10.  
  11. if (!(getAcceleration() >= 3)) { // if throw detected (acceloration over or equal to 3), run function
  12.  
  13. setMainLed({ // set led to green, let user know throw has been detected
  14. r: 0,
  15. g: 255,
  16. b: 0
  17. });
  18.  
  19. await Sound.Animal.play(false); // play random animal sound while also waiting until it is done to continue
  20.  
  21. } // end if statement (end main game)
  22.  
  23. await delay(0.5); // wait small ammount of time (500 ms) before looping again
  24.  
  25. } // end of infinite loop
  26.  
  27. } // end main program async
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement