This will echo what you type directly to the LCD and serial.

Dependencies:   TextLCD mbed

main.cpp

Committer:
dan_cuspi
Date:
2013-09-07
Revision:
0:43501f452595

File content as of revision 0:43501f452595:

#include "TextLCD.h"
#include "mbed.h"
TextLCD lcd(p21, p22, p23, p24, p25, p26); // rs, e, d4-d7
Serial pc(USBTX, USBRX);

int main()
{
    char c;
    int i=0;
    pc.printf("\x1B[2J");
    pc.printf("\x1B[H");
    pc.printf("Echoes back to the screen and LCD anything you type\n\r");
    while(1) {

        c=(pc.putc(pc.getc()));
        lcd.printf("%c",c);
        i++;



        if (i==32) {
            wait(0.1);
            lcd.cls();//clear
            pc.printf("\x1B[2J");
            pc.printf("\x1B[H");
            i=0;
        }
    }


}