This small library allows you to connect an ESP8266 running NodeMCU to a character LCD display based on the HD44780 chip.
To use as little GPIOs as possible, this library assumes that the display is connected to the ESP8266 through an I2C expander, specifically the Microchip MCP23008 in Adafruit's i2c / SPI character LCD backpack.
The code is a mix between Adafruit's LiquidCrystal library for Arduino and the code from this forum post.
local lcd = require("i2clcd")
-- use GPIO pin 7 and 6 for SDA and SCL respectively,
-- and tell the library the display is 16x2 characters big.
lcd.begin(7, 6, 16, 2)
lcd.setBacklight(1) -- will turn on backlight if available
lcd.print("Hello world!")
- An ESP8266 module
- Adafruit's i2c / SPI character LCD backpack
- A level shifter like this, because ESP8266 works with 3.3V TTL, but the backpack works at 5V levels
- NodeMCU with the following modules built: node, GPIO, file, i2c, tmr, bit
- The mcp23008 module for NodeMCU