Winfried Sjoukes
/
Tetris
Plays the Tetris theme on a buzzer
Fork of popcorn by
Diff: main.cpp
- Revision:
- 1:5d7ecf6a9525
- Parent:
- 0:a0cac22ff2e7
diff -r a0cac22ff2e7 -r 5d7ecf6a9525 main.cpp --- a/main.cpp Fri May 20 15:59:17 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -#include "mbed.h" -#include "beep.h" -Beep buzzer(p23); - -DigitalOut myled(LED1); - -void play(char* note); - -void popcorn() { - - play("e"); - play("d"); - play("e"); - play("c"); - play("gb"); - play("c"); - play("eb"); - play("w"); - play("e"); - play("d"); - play("e"); - play("c"); - play("gb"); - play("c"); - play("eb"); - play("w"); - - play("e"); - play("f#"); - play("g"); - play("f#"); - play("g"); - play("e"); - play("f#"); - play("e"); - play("f#"); - play("d"); - play("e"); - play("d"); - play("e"); - play("d"); - play("e"); - - play("w"); - - play("e"); - play("d"); - play("e"); - play("c"); - play("gb"); - play("c"); - play("eb"); - play("w"); - play("e"); - play("d"); - play("e"); - play("c"); - play("gb"); - play("c"); - play("eb"); - play("w"); - - play("e"); - play("f#"); - play("g"); - play("f#"); - play("g"); - play("e"); - play("f#"); - play("e"); - play("f#"); - play("d"); - play("e"); - play("d"); - play("e"); - play("d"); - play("g"); - -} - - -void play(char* note) { - if (note=="a") { - buzzer.beep(880,0.1); - } - if (note=="b") { - buzzer.beep(987,0.1); - } - if (note=="c") { - buzzer.beep(1024,0.1); - } - if (note=="d") { - buzzer.beep(1175,0.1); - } - if (note=="e") { - buzzer.beep(1319,0.1); - } - if (note=="f") { - buzzer.beep(1397,0.1); - } - if (note=="g") { - buzzer.beep(1568,0.1); - } - - if (note=="gb") { - buzzer.beep(830,0.1); - } - if (note=="eb") { - buzzer.beep(659,0.1); - } - if (note=="f#") { - buzzer.beep(1480,0.1); - } - if (note=="w") { - wait(0.05); - } - wait (0.2); //wait while the note plays. -} - - -int main() { - popcorn(); -}