Serial LCD test

Dependencies:   mbed

main.cpp

Committer:
pangsk
Date:
2010-08-05
Revision:
0:09a8d78b652a
Child:
1:92c28d096a2f

File content as of revision 0:09a8d78b652a:

/*

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);
    }
}