LCD 16x2, www.Sparkfun.com part LCD-09067, serial enabled
Diff: main.cpp
- Revision:
- 2:062905d74f97
- Parent:
- 1:c5d938ddc153
--- a/main.cpp Fri Sep 22 20:51:09 2017 +0000
+++ b/main.cpp Sun Nov 12 14:59:04 2017 +0000
@@ -1,12 +1,20 @@
#include "mbed.h"
-//--- Spark fun part LCD-09067
-//-------- LCD 2x26 ----------
+//--- Sparkfun part LCD-09067
+//-------- LCD 16x2 ----------
// MBED p28-------------------RX
// MBED Vout------------------5V (text on LCD is wrong must be 3,3 Volt)
// MBED GND-------------------GND
// ---------------------------
+// or
+// KL25Z PTE0 (TX)-------------RX
+// KL25Z Vout------------------3.3V (text on LCD is wrong must be 3,3 Volt)
+// KL25Z GND-------------------GND
+// ---------------------------
-Serial lcd(p28, p27); // tx, rx
+
+Serial lcd(PTE0, PTE1); // tx, rx (mbed)
+Serial pc(USBTX, USBRX); // to PC
+
void clear_lcd(void);
void move_cursor(int, int);
@@ -15,15 +23,17 @@
lcd.baud(9600);
clear_lcd();
- lcd.printf("Hello World");
+ lcd.printf("LCD-09067");
wait(1);
clear_lcd();
while (1) {
- move_cursor(0,3);
+ move_cursor(0,0);
lcd.printf("pos %02d", c);
- move_cursor(1,3);
+ wait_ms(200);
+ move_cursor(1,0);
lcd.printf("speed %02d", c);
+ wait_ms(200);
c += 1;
}
}
@@ -43,4 +53,5 @@
cp = pos + (line * 64) +128;
lcd.putc(0xFE);
lcd.putc(cp);
+ pc.printf("%d\r\n",cp);
}
\ No newline at end of file