Akash Dwivedi
/
congolcd
this is an lcd program for a game
Diff: main.cpp
- Revision:
- 0:0d7325bb3025
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 23 06:00:16 2013 +0000 @@ -0,0 +1,53 @@ +// Hello World! for the TextLCD + +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7 +int x=9; +int y=9; +int z; +int main() { + + lcd.printf("PLAYER-1..."); + lcd.printf("%i\n",x); + lcd.printf("PLAYER-2..."); + lcd.printf("%i",y); + if((x>=9)||(y>=9)) + { + lcd.cls(); + + if(x>y) + { + while(1){ + lcd.printf("****CONGRATS****\n"); + wait(0.5); + lcd.cls(); + lcd.printf("PLAYER-1 won by"); + int z = x-y; + lcd.printf("%i",z); + lcd.printf("points"); + wait(0.5); + lcd.cls();} + } + if(x<y) + { + while(1){ + lcd.printf("****CONGRATS****\n"); + wait(0.5); + lcd.cls(); + lcd.printf("PLAYER-2 wins by"); + int z = y-x; + lcd.printf("%i",z); + lcd.printf("points"); + wait(0.5); + lcd.cls();} + } + if(x==y) + { + lcd.printf("MATCH TIED\n"); + } +} + + } + \ No newline at end of file