A sample program for custom character in lcd

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mbeded
Date:
Thu Jul 03 21:14:28 2014 +0000
Parent:
0:310523b6696e
Commit message:
bello and tongue and hello

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 310523b6696e -r e6f698c0d7af TextLCD.lib
--- a/TextLCD.lib	Thu Jul 03 20:06:40 2014 +0000
+++ b/TextLCD.lib	Thu Jul 03 21:14:28 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbeded/code/TextLCD/#0a5271dd8a9c
+http://mbed.org/users/mbeded/code/TextLCD/#c382632a6e27
diff -r 310523b6696e -r e6f698c0d7af main.cpp
--- a/main.cpp	Thu Jul 03 20:06:40 2014 +0000
+++ b/main.cpp	Thu Jul 03 21:14:28 2014 +0000
@@ -1,7 +1,7 @@
 #include "mbed.h"
 #include "TextLCD.h"
 
-TextLCD di(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2);
+TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2);
 
 int cur = 0;
 int mov = 1;
@@ -11,36 +11,36 @@
 char hello[] = {4,12,30,31,17,17,14,0};
 char comey[] = {0,0,30,31,21,17,14,0};
 
-int main() 
+int main()
 {
-    di.createChar(0, smile);
-    di.createChar(1, hello);
-    di.createChar(2, comey);
-    di.createChar(7, tongue);
+    lcd.createChar(0, smile);
+    lcd.createChar(1, hello);
+    lcd.createChar(2, comey);
+    lcd.createChar(7, tongue);
     while(1)
     {
-        di.cls();
-        di.setAddress(cur,0);
-        di.printf("BELLO");
-        di.setAddress(0,1);
-        di.putc(0);
-        di.setAddress(4,1);
-        di.putc(1);
+        lcd.clear();
+        lcd.setCursor(cur,0);
+        lcd.printf("BELLO");
+        lcd.setCursor(0,1);
+        lcd.putc(0);
+        lcd.setCursor(4,1);
+        lcd.putc(1);
         cur = cur + mov;
         if(cur >= 11 || cur <= 0)
             mov = -mov;
         wait(1);
 
-        di.cls();
-        di.setAddress(cur,0);
-        di.printf("BELLO");
-        di.setAddress(0,1);
-        di.putc(7);
-        di.setAddress(4,1);
-        di.putc(2);
-        wait(1);
+        lcd.clear();
+        lcd.setCursor(cur,0);
+        lcd.printf("BELLO");
+        lcd.setCursor(0,1);
+        lcd.putc(7);
+        lcd.setCursor(4,1);
+        lcd.putc(2);
         cur = cur + mov;
         if(cur >= 11 || cur <= 0)
-            mov = -mov;    
+            mov = -mov; 
+        wait(1);
     }
 }