Based on the NewTextLib, I made a modification for using this lib on the Elmicro Testbed with display GDM2004D

Dependencies:   mbed

Committer:
TP
Date:
Sat Jun 11 20:34:14 2011 +0000
Revision:
0:9c69fa6c1120

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TP 0:9c69fa6c1120 1 // Hello World! for the TextLCD with Elmicro Testbed LCD display GDM2004D
TP 0:9c69fa6c1120 2 // With modified NewTextLCD library
TP 0:9c69fa6c1120 3
TP 0:9c69fa6c1120 4 #include "mbed.h"
TP 0:9c69fa6c1120 5 #include "NewTextLCD.h"
TP 0:9c69fa6c1120 6
TP 0:9c69fa6c1120 7 DigitalOut myled(LED1); //for blinking purposes
TP 0:9c69fa6c1120 8 AnalogIn Potm(p15); //var. resistor
TP 0:9c69fa6c1120 9 TextLCD lcd(p26, p25, p24, p23, p22, p20, p19, TextLCD::LCD20x4); // rs, rw, e, d4-d7
TP 0:9c69fa6c1120 10
TP 0:9c69fa6c1120 11 float delay_time = 1.0;
TP 0:9c69fa6c1120 12
TP 0:9c69fa6c1120 13 int main() {
TP 0:9c69fa6c1120 14 lcd.printf("Hello mbed\n");
TP 0:9c69fa6c1120 15 //define user chars
TP 0:9c69fa6c1120 16 int pattern[8];
TP 0:9c69fa6c1120 17 int pattern1[8];
TP 0:9c69fa6c1120 18 pattern[0] = 1; // *
TP 0:9c69fa6c1120 19 pattern[1] = 3; // **
TP 0:9c69fa6c1120 20 pattern[2] = 5; // * *
TP 0:9c69fa6c1120 21 pattern[3] = 9; // * *
TP 0:9c69fa6c1120 22 pattern[4] = 0x11; // * *
TP 0:9c69fa6c1120 23 pattern[5] = 0x19; // ** *
TP 0:9c69fa6c1120 24 pattern[6] = 0x1d; // *** *
TP 0:9c69fa6c1120 25 pattern[7] = 0x1f; // *****
TP 0:9c69fa6c1120 26
TP 0:9c69fa6c1120 27 pattern1[0] = 0x10; // *
TP 0:9c69fa6c1120 28 pattern1[1] = 0x18; // **
TP 0:9c69fa6c1120 29 pattern1[2] = 0x14; // * *
TP 0:9c69fa6c1120 30 pattern1[3] = 0x12; // * *
TP 0:9c69fa6c1120 31 pattern1[4] = 0x11; // * *
TP 0:9c69fa6c1120 32 pattern1[5] = 0x13; // * **
TP 0:9c69fa6c1120 33 pattern1[6] = 0x17; // * ***
TP 0:9c69fa6c1120 34 pattern1[7] = 0x1f; // *****
TP 0:9c69fa6c1120 35
TP 0:9c69fa6c1120 36 lcd.writeCGRAM(0, pattern);
TP 0:9c69fa6c1120 37 lcd.writeCGRAM(1, pattern1);
TP 0:9c69fa6c1120 38
TP 0:9c69fa6c1120 39 lcd.locate(15,0);
TP 0:9c69fa6c1120 40 lcd.putc(0); // user pattern 0
TP 0:9c69fa6c1120 41 lcd.putc(1); // user pattern 1
TP 0:9c69fa6c1120 42 lcd.locate(0,1);
TP 0:9c69fa6c1120 43 lcd.printf("Hello World!\n");
TP 0:9c69fa6c1120 44 while(1)
TP 0:9c69fa6c1120 45 {
TP 0:9c69fa6c1120 46 delay_time = Potm.read();
TP 0:9c69fa6c1120 47 myled = 1;
TP 0:9c69fa6c1120 48 wait(delay_time);
TP 0:9c69fa6c1120 49 myled = 0;
TP 0:9c69fa6c1120 50 wait(delay_time);
TP 0:9c69fa6c1120 51 lcd.locate(0,2);
TP 0:9c69fa6c1120 52 lcd.printf("Value: %1.2f", delay_time);
TP 0:9c69fa6c1120 53 }
TP 0:9c69fa6c1120 54 }