Mathéo Guichard / Mbed 2 deprecated I2CTextLCD

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mathsmurfff
Date:
Wed Jun 05 11:09:14 2019 +0000
Parent:
0:6beb6f498640
Commit message:
change I2CTextLCD for LCD Chinese model PCF8574 address 0x7E

Changed in this revision

TextLCD.cpp Show annotated file Show diff for this revision Revisions of this file
TextLCD.h 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/TextLCD.cpp	Mon Aug 09 14:17:02 2010 +0000
+++ b/TextLCD.cpp	Wed Jun 05 11:09:14 2019 +0000
@@ -120,6 +120,8 @@
 }
 
 void TextLCD::writeNibble(int data, bool rs) {
+    data<<=4;
+    data|=8;
     if (rs) {
         data = data | RS_ON; // set rs bit
     }
--- a/TextLCD.h	Mon Aug 09 14:17:02 2010 +0000
+++ b/TextLCD.h	Wed Jun 05 11:09:14 2019 +0000
@@ -25,8 +25,8 @@
 
 #include "mbed.h"
 
-#define E_ON 0x10
-#define RS_ON 0x80
+#define E_ON 0x4
+#define RS_ON 0x1
 
 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
  *
@@ -61,7 +61,7 @@
      * @param d0-d3 Data lines
      * @param type  Sets the panel size/addressing mode (default = LCD16x2)
      */
-    TextLCD(PinName sda, PinName scl, int i2cAddress = 0x40, LCDType type = LCD16x2);
+    TextLCD(PinName sda, PinName scl, int i2cAddress = 0x7e, LCDType type = LCD16x2);
 
 #if DOXYGEN_ONLY
     /** Write a character to the LCD
--- a/main.cpp	Mon Aug 09 14:17:02 2010 +0000
+++ b/main.cpp	Wed Jun 05 11:09:14 2019 +0000
@@ -1,8 +1,13 @@
 #include "mbed.h"
 #include "TextLCD.h"
 
-TextLCD lcd(p9, p10);
+TextLCD lcd(D14, D15, 0x7e);
 
-int main() {
-    lcd.printf("Hi mbed World!\n");
+int main()
+{
+    while(1) {
+        lcd.printf("Hi mbed World!\n");
+        wait_ms(50);
+    }
 }
+
--- a/mbed.bld	Mon Aug 09 14:17:02 2010 +0000
+++ b/mbed.bld	Wed Jun 05 11:09:14 2019 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file