Akash Dwivedi / Mbed 2 deprecated congolcd

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Hello World! for the TextLCD
00002 
00003 #include "mbed.h"
00004 #include "TextLCD.h"
00005 
00006 TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
00007 int x=9;
00008 int y=9;
00009 int z;
00010 int main() {
00011 
00012     lcd.printf("PLAYER-1...");
00013      lcd.printf("%i\n",x);
00014       lcd.printf("PLAYER-2...");
00015       lcd.printf("%i",y);
00016       if((x>=9)||(y>=9))
00017       {
00018       lcd.cls();
00019 
00020        if(x>y)
00021        {
00022        while(1){
00023        lcd.printf("****CONGRATS****\n");
00024        wait(0.5);
00025        lcd.cls();
00026        lcd.printf("PLAYER-1 won by");
00027        int z = x-y;
00028        lcd.printf("%i",z);
00029        lcd.printf("points");
00030        wait(0.5);
00031        lcd.cls();}
00032        }
00033        if(x<y)
00034        {
00035        while(1){
00036        lcd.printf("****CONGRATS****\n");
00037        wait(0.5);
00038        lcd.cls();
00039        lcd.printf("PLAYER-2 wins by");
00040        int z = y-x;
00041        lcd.printf("%i",z);
00042        lcd.printf("points");
00043        wait(0.5);
00044        lcd.cls();}
00045        }
00046        if(x==y)
00047        {
00048        lcd.printf("MATCH TIED\n");
00049      }
00050 }
00051 
00052        }
00053