Sukkin Pang
/
serial_lcd
Serial LCD test
Diff: main.cpp
- Revision:
- 0:09a8d78b652a
- Child:
- 1:92c28d096a2f
diff -r 000000000000 -r 09a8d78b652a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Aug 05 20:32:39 2010 +0000 @@ -0,0 +1,46 @@ +/* + +Serial LCD + +This program is to demostrate the use of a Serial LCD + +Serial LCD used: +http://www.skpang.co.uk/catalog/product_info.php?cPath=91_100_101&products_id=571 + +v1.0 August 2010 + +*/ + + +#include "mbed.h" + +//LCD commands +#define COMMAND 0xFE +#define CLEAR 0x01 +#define LINE0 0x80 +#define LINE1 0xC0 + + +DigitalOut myled(LED1); +Serial lcd(p9, p10); // tx, rx + +int main() { + + lcd.baud(9600); + lcd.putc(COMMAND); + lcd.putc(CLEAR); //Clear screen + + lcd.printf("Hello World"); + + lcd.putc(COMMAND); + lcd.putc(LINE1); //Set cursor to second line + + lcd.printf("www.skpang.co.uk"); + + while(1) { + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + } +}