wifi_mqtt_hcsr04_lcd1602_i2c
Revision 1:e045394f109e, committed 2022-01-20
- Comitter:
- awali
- Date:
- Thu Jan 20 09:26:21 2022 +0000
- Parent:
- 0:824096cc05af
- Commit message:
- 1
Changed in this revision
diff -r 824096cc05af -r e045394f109e LiquidCrystal_I2C.cpp --- a/LiquidCrystal_I2C.cpp Fri May 19 18:21:24 2017 +0000 +++ b/LiquidCrystal_I2C.cpp Thu Jan 20 09:26:21 2022 +0000 @@ -21,7 +21,7 @@ // LiquidCrystal constructor is called). -I2C _i2c(PB_11, PB_10); // SDA, SCL +I2C _i2c(D14, D15); // SDA, SCL LiquidCrystal_I2C::LiquidCrystal_I2C(unsigned char lcd_addr, unsigned char lcd_cols, unsigned char lcd_rows, unsigned char charsize) { @@ -48,11 +48,13 @@ // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! // according to datasheet, we need at least 40ms after power rises above 2.7V // before sending commands. Arduino can turn on way befer 4.5V so we'll wait 50 - wait_ms(50); + // wait_ms(50); + wait_us(50000); // Now we pull both RS and R/W low to begin commands expanderWrite(_backlightval); // reset expanderand turn backlight off (Bit 8 =1) - wait_ms(1000); + // wait_ms(1000); + wait_us(10000); //put the LCD into 4 bit mode // this is according to the hitachi HD44780 datasheet
diff -r 824096cc05af -r e045394f109e main.cpp --- a/main.cpp Fri May 19 18:21:24 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -#include "mbed.h" -#include <LiquidCrystal_I2C.h> - -// Set the LCD address to 0x27 for a 16 chars and 2 line display -LiquidCrystal_I2C lcd(0x4E, 16, 2); - - - -int main() -{ - - // initialize the LCD - lcd.begin(); - - // Turn on the blacklight and print a message. - lcd.backlight(); - lcd.print("Hello, world!"); - - while (1) { - /* - // Read temperature register - data_write[0] = LM75_REG_TEMP; - i2c.write(LM75_ADDR, data_write, 1, 1); // no stop - i2c.stop(); - wait(0.01); - i2c.read(LM75_ADDR, data_read, 2, 0); - i2c.stop(); -*/ - wait(0.01); - } - -} -
diff -r 824096cc05af -r e045394f109e mbed.bld --- a/mbed.bld Fri May 19 18:21:24 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file