-
-
Save bavensky/8cc772149df9e349014b to your computer and use it in GitHub Desktop.
// ESP8266 with 20x4 i2c LCD | |
// Compatible with the Arduino IDE 1.6.4 | |
// Library https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library | |
// Bavensky :3 | |
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x20,20,4); | |
uint8_t heart[8] = {0x0,0xa,0x1f,0x1f,0xe,0x4,0x0}; | |
void setup() { | |
#Wire.begin(0, 2); // For ESP-01 device cc.isidorogv | |
lcd.begin(); | |
lcd.backlight(); | |
lcd.createChar(1, heart); | |
} | |
void loop() { | |
lcd.home(); | |
lcd.print("Welcome to my world!"); | |
lcd.setCursor(2, 1); | |
lcd.write(byte(1)); | |
lcd.print(" ESP8266 with"); | |
lcd.setCursor(0, 2); | |
lcd.print(" LiquidCrystal I2C "); | |
lcd.setCursor(0, 3); | |
lcd.print("ChiangMai Maker Club"); | |
} |
Where you connect the SDA and SCLK to the ESP8266 GPIO?
Just add the following line to your setup function:
Wire.begin(0, 2);
where 0 is for the SDA and 2 is for SCLK. Note that this setup is for an ESP-01 device. By default, the pins are 4(SDA) and 5(SCLK).
how to connect. i use d1,d2 or d3 d4 in nodemcu board and it dont work
how to connect. i use d1,d2 or d3 d4 in nodemcu board and it dont work
Did you find a solution ?
lcd.init() should be lcd.begin() I think....
lcd.begin() that's correct. I fix it already. Thanks
ESP8266 GPIO
It's should be pin GPIO4 and GPIO5 on ESP8266
how to connect. i use d1,d2 or d3 d4 in nodemcu board and it dont work
You have to connect pin GPIO4 for SDA and GPIO5 for SCL and Use "i2c_scanner" on Arduino IDE Example for check if the device it's connected.
would it be possible to have the SDA and SCLK lines connected to GPIO9 and GPIO10 on the NodeMCU ?
Problem is that I'm already using all the pins on the other side (excepted TX) and I just want to connect a 2004A LCD display for setup/debug of values read on the ADC. I'm multiplexing 4 inputs for the ADC but need to trim them with a multi-turn potmeter and it would be much easier with the LCD rather then the serial monitor.
Furthermore, #Wire.begin(...) gives "invalid preprocessing directive #Wire" error
lcd.init() should be lcd.begin() I think....