Skip to content

Instantly share code, notes, and snippets.

@travischambers
Forked from Colelyman/gist:4049013
Created November 10, 2012 00:08
Show Gist options
  • Save travischambers/4049167 to your computer and use it in GitHub Desktop.
Save travischambers/4049167 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