Peter's version

Fork of ScoreCount by George Cochrane

main.cpp

Committer:
gcme93
Date:
2013-05-01
Revision:
0:c82f950266fc
Child:
1:d41b5b18175b

File content as of revision 0:c82f950266fc:

#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;    
}
}