LCD 16x2, www.Sparkfun.com part LCD-09067, serial enabled

Dependencies:   mbed

Revision:
0:e7b0972dec10
Child:
1:c5d938ddc153
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Dec 31 18:44:38 2010 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+//--- Spark fun part LCD-09067
+//-------- LCD 2x26 ----------
+// MBED p28-------------------RX
+// MBED Vout------------------5V (text on LCD is wrong must be 3,3 Volt)
+// MBED GND-------------------GND
+// ---------------------------
+
+Serial lcd(p28, p27);       // tx, rx
+void clear(void);
+void move_cursor(int, int);
+
+int main() {
+    int c=0;
+    lcd.baud(9600);
+    
+    clear();
+    lcd.printf("Hello World");
+    wait(1);
+    clear();
+
+    while (1) {
+        move_cursor(0,3);
+        lcd.printf("pos %02d", c);
+        move_cursor(1,3);
+        lcd.printf("speed %02d", c);
+        c += 1;
+    }
+}
+
+//------clears the dispaly--------
+void clear(void) {
+    lcd.putc(0xFE);
+    lcd.putc(0x01);
+}
+
+//----------- line 0 or 1----------
+//----------- position 0/15--------
+// (0,0) is top left position
+// (1,15) is bottom right position
+void move_cursor(int line, int pos) {
+    int cp;
+    cp = pos + (line * 64) +128;
+    lcd.putc(0xFE);
+    lcd.putc(cp);
+}
\ No newline at end of file