test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
kaku_jyoko
Date:
Sat Dec 10 13:11:18 2016 +0000
Parent:
18:0f6f2aa2339d
Child:
20:1dc1560a4902
Commit message:
fixed input button

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Dec 06 15:09:16 2016 +0000
+++ b/main.cpp	Sat Dec 10 13:11:18 2016 +0000
@@ -19,6 +19,7 @@
 Person h;
 Serial pc(USBTX, USBRX); // tx, rx
 Bullet* b = NULL;
+Timer t;
 
 
 void a(){
@@ -40,12 +41,13 @@
     start.y = 27;
     char c;
     while(true){
+        t.start();
         c = pc.getc();
-        if(c == 'a'){
+        if(c == 'a' && t.read() > 5.0){
+            b = NULL;
             b = &Bullet(start, 2);
-            wait(5);
+            t.reset();
         }
-        b = NULL;
     }
 }