Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function startProgram() { // start main program as an asynchronous function
- while (true) { // infinite loop
- setMainLed({ // set led to blue, let user know game is ready to play
- r: 0,
- g: 0,
- b: 255
- });
- if (!(getAcceleration() >= 3)) { // if throw detected (acceloration over or equal to 3), run function
- setMainLed({ // set led to green, let user know throw has been detected
- r: 0,
- g: 255,
- b: 0
- });
- await Sound.Animal.play(false); // play random animal sound while also waiting until it is done to continue
- } // end if statement (end main game)
- await delay(0.5); // wait small ammount of time (500 ms) before looping again
- } // end of infinite loop
- } // end main program async
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement