test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Diff: main.cpp
- Revision:
- 62:5d3f6c919fbc
- Parent:
- 61:d44faf074743
- Child:
- 63:4c22abbe4727
--- a/main.cpp Wed Dec 14 12:04:51 2016 +0000 +++ b/main.cpp Wed Dec 14 14:24:27 2016 +0000 @@ -14,7 +14,7 @@ // down: p12, left: p13, center: p14, up: p15, right: p16 InterruptIn button(p14); AnalogIn aIn(p20); -DigitalOut led1(LED1); +BusOut leds(LED1, LED2, LED3, LED4); Mutex jump_mtx; Mutex update_mtx; @@ -33,8 +33,6 @@ Converter converter; wall_height = stage.getStage(); - - //initialize white board for(int i = 0; i < LCD_Y; i++){ for (int j = 0; j < LCD_X; j++){ @@ -83,6 +81,17 @@ t.start(); c = pc.getc(); bullet_mtx.lock(); + if(t.read() > 5.0){ + leds = 0xf; + }else if(t.read() > (5.0 / 4.0 * 3.0)){ + leds = 0x7; + }else if(t.read() > (5.0 / 4.0 * 2.0)){ + leds = 0x3; + }else if(t.read() > (5.0 / 4.0 * 1.0)){ + leds = 0x1; + }else { + leds = 0x0; + } if(c >= '1' && c <= '9' && t.read() > 5.0){ b = NULL; switch(c){