Example of using a GDM2004D LCD with Elmicro\'s TestBed for mbed carrier board. Uses an altered version of the TextLCD-library.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File


00001 #include "mbed.h"
00002 //the library "TextLCD.h" was slightly altered to work with the GDM2004D LCD
00003 #include "TextLCD.h"
00005 //the object "lcd" is initialized to act as a TextLCD with 20x4 characters
00006 TextLCD lcd(p26, p25, p24, p23, p22, p20, p19, TextLCD::LCD20x4);
00008 int main() {
00009     //each line of the LCD can be accessed directly using the .locate(column, line) function
00010     lcd.locate(0,0);
00011     lcd.printf("12345678901234567890");
00012     lcd.locate(0,1);
00013     lcd.printf("UVWXYZabcdefghijklmn");    
00014     lcd.locate(0,2);    
00015     lcd.printf("ABCDEFGHIJKLMNOPQRST");
00016     lcd.locate(0,3);
00017     lcd.printf("12345678901234567890");    
00018     wait(2);
00020     //the LCD is cleared using function .cls()
00021     lcd.cls();
00022     //a "\n" in a text string causes a line feed
00023     lcd.printf("HELLO WORLD\n");
00024     //if the end of a line is reached, the text is written to the next line automatically
00025     lcd.printf("Testbed for mbed\nLCD example softwarewith altered library");
00027     //the endless loop keeps mbed in low power mode
00028     while(1)
00029     {
00030     __WFI();
00031     }
00032 }