this is an lcd program for a game

Dependencies:   TextLCD mbed

main.cpp

Committer:
akashdd
Date:
2013-10-23
Revision:
0:0d7325bb3025

File content as of revision 0:0d7325bb3025:

// 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");
     }
}

       }