Counter with LCD Display

Dependencies:   TextLCD mbed

main.cpp

Committer:
bromand
Date:
2011-06-28
Revision:
1:f580beec166a
Parent:
0:1abd7e24ae31

File content as of revision 1:f580beec166a:

//Include mbed header file which contains the definition of DigitalOut class. 
#include "mbed.h"
//Include TextLCD header file which contains the definition of TextLCD class. 
#include "TextLCD.h"

//Initialize TextLCD with the correct pins
TextLCD lcd(p24, p26, p27, p28, p29, p30);

//Main function
int main() 
{ 
    //Clear the LCD display
    lcd.cls();
    //Locate Row 0 Column 0 in the LCD display
    lcd.locate(0, 0);
    //Print "The End"
    lcd.printf("Start Counting:");    
    //Iterate between 0 and 1000. 
    for(int i=0 ; i<=1000 ; i++)
    {
        //Locate Row 1 Column 0 in the LCD display
        lcd.locate(0, 1);
        //Call PrintToLCD function
        lcd.printf("%d", i);
        //wait for 250ms
        wait(0.25);
    }
    //Clear the LCD display
    lcd.cls();
    //Locate Row 0 Column 0 in the LCD display
    lcd.locate(0, 0);
    //Print "The End"
    lcd.printf("The End!!!");    
}