Created
November 9, 2012 23:30
-
-
Save Colelyman/4049013 to your computer and use it in GitHub Desktop.
Simon 124 Cole Lyman
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
// Beginning of our code | |
int beat_counter = 0; | |
int rand_array[] = 100; | |
bool fail = true; | |
setrandSeed(); | |
do { // loop for each round | |
rand_array[beat_counter] = rand16(); | |
for(int beat = 0; beat <= beat_counter; beat++) { | |
toneON(rand_array[beat]); | |
LEDs(rand_array[beat]); | |
delay(); | |
toneOFF(); | |
if(getSwitch() != rand_array[beat]) { | |
// play rasberry | |
bool fail = false; | |
break; | |
} | |
} | |
if(!fail) break; | |
// play congratulary tone | |
beat_counter++; | |
} while(fail); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment