QuickClick, a reaction timing game which allows single and multiplayer mode.
Dependencies: Controller Display N5110 Operator mbed
Diff: main.cpp
- Revision:
- 1:fd22ccce4fe9
- Parent:
- 0:e19df24a20fc
- Child:
- 2:c3d86dd51b69
--- a/main.cpp Wed Apr 12 13:54:12 2017 +0000 +++ b/main.cpp Wed Apr 12 22:20:33 2017 +0000 @@ -3,12 +3,12 @@ #include "mbed.h" #include "N5110.h" #include "Display.h" -#include "Gamepad.h" +#include "Controller.h" #include "Operator.h" N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Display display; -Gamepad pad; +Controller pad; Operator Opp; int button_val; int instruction_val; @@ -24,12 +24,9 @@ pad.init(); starter(); while(1) { - display.drawCircle(lcd); - instruction_val = Opp.read_instruction(display); + instruction_val = Opp.random_instruction(display, lcd); + display.drawCircle(lcd); button_val = Opp.read_input(pad); - - - if (button_val == instruction_val) { score++; pad.led(1,1); @@ -64,7 +61,7 @@ lcd.refresh(); // wait flashing LEDs until start button is pressed - while ( pad.check_event(Gamepad::START_PRESSED) == false) { + while ( pad.check_event(Controller::START_PRESSED) == false) { pad.leds_on(); wait(0.1); pad.leds_off();