Seeedstudio Arch Examples : Grove Serial LCD - Print strings and numbers

Dependencies:   Grove_Serial_LCD mbed

main.cpp

Committer:
viswesr
Date:
2013-10-24
Revision:
0:a4da5990eeb8

File content as of revision 0:a4da5990eeb8:

#include "mbed.h"
#include "SerialLCD.h"
 
SerialLCD lcd(P1_13, P1_14);  /* Grove Serial LCD is connected to UART Tx and Rx pins*/
 
int main() {
    int a=0;    
    char strBuffer[16];
    
    lcd.begin();                 /* initialize Serial LCD communication. */ 
    lcd.print("mbed with Arch"); /* print text */
    
    while (1) {
         
        lcd.setCursor(0, 1);         /* set cursor at 0th column and 1st row */
        sprintf(strBuffer, "%d", a); /* prepare a string buffer to print number */   
        lcd.print(strBuffer);        /* print the string buffer */
        wait(0.1);                   /* wait 100ms */ 
        a++;
    }
}