QuickClick, a reaction timing game which allows single and multiplayer mode.

Dependencies:   Controller Display N5110 Operator mbed

Revision:
0:e19df24a20fc
Child:
1:fd22ccce4fe9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Apr 12 13:54:12 2017 +0000
@@ -0,0 +1,74 @@
+//Dom
+
+#include "mbed.h"
+#include "N5110.h"
+#include "Display.h" 
+#include "Gamepad.h" 
+#include "Operator.h"
+
+N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); 
+Display display; 
+Gamepad pad; 
+Operator Opp; 
+int button_val;
+int instruction_val;
+int score;
+void starter();
+
+int main() {
+    button_val=0;
+    score = 0;
+    lcd.init();  
+    Opp.init();
+    display.init(); 
+    pad.init(); 
+    starter(); 
+    while(1) {
+    display.drawCircle(lcd);
+    instruction_val = Opp.read_instruction(display); 
+    button_val = Opp.read_input(pad);  
+    
+    
+    
+    if (button_val == instruction_val) {
+        score++;
+        pad.led(1,1); 
+        pad.led(2,1); 
+        pad.led(3,1); 
+        pad.tone(100.0,0.2);  
+        char buffer[14];
+        sprintf(buffer,"Button = %2d",button_val);
+        lcd.printString(buffer,0,1);
+        lcd.refresh();
+        } else {
+        pad.tone(700.0,1);
+        char buffer[14];
+        sprintf(buffer,"Score = %2d",score);
+        lcd.printString(buffer,0,1);
+        lcd.refresh(); 
+        pad.leds_off();
+        pad.led(4,1); 
+        pad.led(5,1); 
+        pad.led(6,1);
+        break;       
+    }
+    wait(0.2);
+  //  pad.tone(50,1); 
+    }
+}
+void starter() {
+  
+    
+    lcd.printString("Doms Game ",0,1);  
+    lcd.printString("  Press Start ",0,4);
+    lcd.refresh();
+     
+    // wait flashing LEDs until start button is pressed 
+    while ( pad.check_event(Gamepad::START_PRESSED) == false) {
+        pad.leds_on();
+        wait(0.1);
+        pad.leds_off();
+        wait(0.1);
+    }
+ 
+}   
\ No newline at end of file