LCD 16x2, www.Sparkfun.com part LCD-09067, serial enabled
Revision 2:062905d74f97, committed 2017-11-12
- Comitter:
- GerritPathuis
- Date:
- Sun Nov 12 14:59:04 2017 +0000
- Parent:
- 1:c5d938ddc153
- Commit message:
- Sparkfun LCD-09067 connected to KL25Z.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- 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
--- a/mbed.bld Fri Sep 22 20:51:09 2017 +0000 +++ b/mbed.bld Sun Nov 12 14:59:04 2017 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/mbed/builds/675da3299148 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file