Skip to content

Instantly share code, notes, and snippets.

@Colelyman
Created November 9, 2012 23:30
Show Gist options
  • Save Colelyman/4049013 to your computer and use it in GitHub Desktop.
Save Colelyman/4049013 to your computer and use it in GitHub Desktop.
Simon 124 Cole Lyman
// 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