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

Dependencies:   Grove_Serial_LCD mbed

Committer:
viswesr
Date:
Thu Oct 24 05:24:29 2013 +0000
Revision:
0:a4da5990eeb8
First version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
viswesr 0:a4da5990eeb8 1 #include "mbed.h"
viswesr 0:a4da5990eeb8 2 #include "SerialLCD.h"
viswesr 0:a4da5990eeb8 3
viswesr 0:a4da5990eeb8 4 SerialLCD lcd(P1_13, P1_14); /* Grove Serial LCD is connected to UART Tx and Rx pins*/
viswesr 0:a4da5990eeb8 5
viswesr 0:a4da5990eeb8 6 int main() {
viswesr 0:a4da5990eeb8 7 int a=0;
viswesr 0:a4da5990eeb8 8 char strBuffer[16];
viswesr 0:a4da5990eeb8 9
viswesr 0:a4da5990eeb8 10 lcd.begin(); /* initialize Serial LCD communication. */
viswesr 0:a4da5990eeb8 11 lcd.print("mbed with Arch"); /* print text */
viswesr 0:a4da5990eeb8 12
viswesr 0:a4da5990eeb8 13 while (1) {
viswesr 0:a4da5990eeb8 14
viswesr 0:a4da5990eeb8 15 lcd.setCursor(0, 1); /* set cursor at 0th column and 1st row */
viswesr 0:a4da5990eeb8 16 sprintf(strBuffer, "%d", a); /* prepare a string buffer to print number */
viswesr 0:a4da5990eeb8 17 lcd.print(strBuffer); /* print the string buffer */
viswesr 0:a4da5990eeb8 18 wait(0.1); /* wait 100ms */
viswesr 0:a4da5990eeb8 19 a++;
viswesr 0:a4da5990eeb8 20 }
viswesr 0:a4da5990eeb8 21 }