![](/media/cache/profiles/004acbc8eefec9fe0629b15f52b94bcf.50x50_q85.jpg)
bad version
Diff: main.cpp
- Revision:
- 0:c82f950266fc
- Child:
- 1:d41b5b18175b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed May 01 13:50:51 2013 +0000 @@ -0,0 +1,62 @@ +#include "mbed.h" +#include "TSISensor.h" +#include "TextLCD.h" + + + +int hit=0; +int lives=20; +float a; +TSISensor tsi; + +DigitalOut Flash(PTC11); + + +TextLCD lcd(PTD7, PTD6, PTA17, PTA16, PTC17, PTC16); // rs, e, d4-d7 + + + +int main() + +{ + +lcd.cls(); + + while(1) + { + + while (lives>-1) + + { + a=tsi.readPercentage(); + + if (a>=0.01) + {hit=1;} + else + {hit=0;} + + + lcd.locate(0,0); + lcd.printf("Lives remaining: %d \n", lives); + + + if (hit==1) + { + + lives--; + + + + } + + } + +lcd.cls(); +lcd.locate(0,0); +lcd.printf(" - GAME OVER - ...you suck"); + +wait(20); +lcd.cls(); +lives=20; +} +} \ No newline at end of file