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:
Wed Feb 04 09:12:38 2015 +0000
Revision:
1:fb29354d9073
Parent:
0:d53b17bb7ffa
Child:
2:0b6e10420ce2
Added Start/Restart button

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 0:d53b17bb7ffa 5 #include <vector>
tsoic 0:d53b17bb7ffa 6
tsoic 0:d53b17bb7ffa 7 class Simon {
tsoic 0:d53b17bb7ffa 8 public:
tsoic 0:d53b17bb7ffa 9 Simon();
tsoic 1:fb29354d9073 10 void gameStart(int);
tsoic 0:d53b17bb7ffa 11 void newQueue();
tsoic 0:d53b17bb7ffa 12 void showQueue();
tsoic 0:d53b17bb7ffa 13 bool userTurn();
tsoic 1:fb29354d9073 14 void LEDSBlink();
tsoic 0:d53b17bb7ffa 15 private:
tsoic 1:fb29354d9073 16 void keyPressedSt();
tsoic 1:fb29354d9073 17 void keyPressedNd();
tsoic 1:fb29354d9073 18 void keyPressedRd();
tsoic 1:fb29354d9073 19 void keyPressedTh();
tsoic 1:fb29354d9073 20 void ReStart();
tsoic 1:fb29354d9073 21 int testQueue();
tsoic 0:d53b17bb7ffa 22 static PinDetect button[];
tsoic 1:fb29354d9073 23 static DigitalOut led[];
tsoic 0:d53b17bb7ffa 24 vector<int> queue;
tsoic 0:d53b17bb7ffa 25 int i, test_val;
tsoic 1:fb29354d9073 26 bool button_press, run;
tsoic 0:d53b17bb7ffa 27 unsigned int turn;
tsoic 0:d53b17bb7ffa 28 };
tsoic 0:d53b17bb7ffa 29 #endif