Simple Simon says mbed game which makes random queue, shows it with onboard LEDs and takes user input with push buttons.

Dependencies:   PinDetect mbed beep

Committer:
tsoic
Date:
Tue Feb 10 12:37:56 2015 +0000
Revision:
5:94c215df2b7c
Parent:
4:32b02dd83c0d
Added piezo speaker and sound effects

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsoic 0:d53b17bb7ffa 1 #ifndef SIMON_H
tsoic 0:d53b17bb7ffa 2 #define SIMON_H
tsoic 0:d53b17bb7ffa 3 #include "mbed.h"
tsoic 0:d53b17bb7ffa 4 #include "PinDetect.h"
tsoic 4:32b02dd83c0d 5 #include "Piezo.h"
tsoic 0:d53b17bb7ffa 6 #include <vector>
tsoic 0:d53b17bb7ffa 7
tsoic 4:32b02dd83c0d 8
tsoic 0:d53b17bb7ffa 9 class Simon {
tsoic 0:d53b17bb7ffa 10 public:
tsoic 0:d53b17bb7ffa 11 Simon();
tsoic 3:75399d0ba94e 12 void gameStart(int);
tsoic 4:32b02dd83c0d 13 private:
tsoic 0:d53b17bb7ffa 14 void newQueue();
tsoic 0:d53b17bb7ffa 15 void showQueue();
tsoic 0:d53b17bb7ffa 16 bool userTurn();
tsoic 3:75399d0ba94e 17 void LEDSBlink();
tsoic 3:75399d0ba94e 18 void keyPressedSt();
tsoic 3:75399d0ba94e 19 void keyPressedNd();
tsoic 3:75399d0ba94e 20 void keyPressedRd();
tsoic 3:75399d0ba94e 21 void keyPressedTh();
tsoic 3:75399d0ba94e 22 void ReStart();
tsoic 3:75399d0ba94e 23 int testQueue();
tsoic 4:32b02dd83c0d 24 Piezo piezo;
tsoic 0:d53b17bb7ffa 25 static PinDetect button[];
tsoic 3:75399d0ba94e 26 static DigitalOut led[];
tsoic 0:d53b17bb7ffa 27 vector<int> queue;
tsoic 3:75399d0ba94e 28 int i, test_val, first_turn;
tsoic 3:75399d0ba94e 29 bool button_press, run;
tsoic 0:d53b17bb7ffa 30 unsigned int turn;
tsoic 0:d53b17bb7ffa 31 };
tsoic 4:32b02dd83c0d 32
tsoic 0:d53b17bb7ffa 33 #endif