QuickClick, a reaction timing game which allows single and multiplayer mode.
Dependencies: Controller Display N5110 Operator mbed
main.cpp
- Committer:
- domkay97
- Date:
- 2017-04-15
- Revision:
- 5:b6fcee26c5ff
- Parent:
- 3:e67f9ba37049
- Child:
- 6:e7510e120617
File content as of revision 5:b6fcee26c5ff:
#include "mbed.h" #include "N5110.h" #include "Display.h" #include "Controller.h" #include "Operator.h" N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Display display; Controller pad; Operator Opp; int button_val; int instruction_val; void starter(); int main() { button_val=0; lcd.init(); Opp.init(); display.init(); pad.init(); starter(); while(1) { instruction_val = Opp.random_instruction(display, lcd); display.drawCircle(pad, lcd); button_val = Opp.read_input(pad); pad.leds_off(); if (button_val == instruction_val) { Opp.Correct(pad); } else { Opp.Game_Over(pad, lcd); display.init(); pad.init(); starter(); } } } void starter() { lcd.clear(); lcd.printString("Quick Click",10,1); lcd.printString("Start >",24,4); lcd.refresh(); while (pad.check_event(Controller::START_PRESSED) == false) { pad.leds_on(); wait(0.1); pad.leds_off(); wait(0.1); } }