test avoid bulled game

Dependencies:   C12832_lcd LCD_fonts mbed mbed-rtos

Revision:
5:651879f4f047
Parent:
4:0fe59e58def9
Child:
6:e63641e13374
diff -r 0fe59e58def9 -r 651879f4f047 main.cpp
--- a/main.cpp	Fri Dec 02 07:35:34 2016 +0000
+++ b/main.cpp	Fri Dec 02 09:37:23 2016 +0000
@@ -5,13 +5,16 @@
 #include "graphics.h"
 #include "models.h"
 #include "rtos.h"
-
+#include "point.h"
 
 C12832_LCD lcd;
 
 // down: p12, left: p13, center: p14, up: p15, right: p16
-DigitalIn button(p14);
+InterruptIn button(p14);
+DigitalOut led1(LED1);
 
+Mutex jump_mtx;
+Mutex update_mtx;
 int jump_flag = 0;
 
 //int main(){
@@ -27,14 +30,43 @@
 //    }
 //}
 
-int main(){
-    Thread receive_th(receive);
+void a(){
+    jump_flag = !jump_flag;
 }
 
 void receive(void const *argument){
     while(true){
         if(button){
-            jump_flag = 1;
+            jump_mtx.lock();
+            button.rise(&a);
+            jump_mtx.unlock();
+            printf("flag %d\n",jump_flag);
+            Thread::wait(0.1);
         }
     }
-}
\ No newline at end of file
+}
+
+
+
+int main(){
+    Person h();
+    point p;
+    printf("hello\n");
+    Thread receive_th(receive);
+    while(true){
+        update_mtx.lock();
+        p = h.update();
+        update_mtx.unlock();
+        lcd.print_bm(bitmPerson,p.x,p.y);
+        lcd.copy_to_lcd();
+        wait(0.5);
+        lcd.print_bm(bitmPersonB,p.x,p.y);
+        lcd.copy_to_lcd();
+        wait(0.5);
+    }
+}
+
+
+
+
+