A little issue with the LCD 1602


#1

Hi again,

I think I’ve got the dhyland’s LCD library to work, since I can now build without errors, and my Main starts running. However, it doesn’t proceed past the LCD init stage, as below:

def main():
“”“Test function for verifying basic functionality.”""
print(“Running test_main”)
lcd = GpioLcd(rs_pin=4,
enable_pin=14,
d4_pin=5,
d5_pin=18,
d6_pin=21,
d7_pin=22,
num_lines=2, num_columns=16)
print(“lcd init done”)
lcd.putstr(“It Works!\nSecond Line”)
sleep(3000)
lcd.clear()
count = 0
while True:
lcd.move_to(0, 0)
lcd.putstr("%7d" % (MILLIS // 1000))
sleep(1000)
count += 1
main()

I see the “running test” part on serial, but not the “lcd init done”. For some reason it hangs before it, but I can’t figure out why.

In the definitions, it was said to wire the E (Enable) pin to ESP32’s D11, but I don’t see an 11, so I put it to 14 instead.

Any hints much appreciated,

-h.


#2

It must be the

lcd = GpioLcd(rs_pin=2,
              enable_pin=14,
              d4_pin=17,
              d5_pin=18,
              d6_pin=21,
              d7_pin=22,
              num_lines=2, num_columns=16)

part, because commenting that out lets the execution go forward. But the wires are connected to those pins.

Should I post the lcdapi.py and GpioLcd.py that I have modified?


#3

Hi @Heikki_Hietala,

are there any news on the development side? Can you post a link to the modified version of the library?


#4

Sorry, nothing yet. I found dhylands on Twitter and asked him to see my issue on Github, but he has not yet responded. I will post more when I get more.


#5

I’ll post the contents of the files here. There are two files, lcdApi.py, and GpioLcd.py. The folder structure I use is

image
lcd libraries.zip (3.6 KB)

The main loop is:

# z\myLCD

from esp32_gpio_lcd import GpioLcd
import streams
streams.serial()

def main():
“”“Test function for verifying basic functionality.”""
print(“Running test_main”)
lcd = GpioLcd(rs_pin=4,
enable_pin=15,
d4_pin=17,
d5_pin=18,
d6_pin=21,
d7_pin=22,
num_lines=2, num_columns=16)
print(“lcd init done”)
lcd.putstr(“It Works!\nSecond Line”)
sleep(3000)
lcd.clear()
count = 0
while True:
lcd.move_to(0, 0)
lcd.putstr("%7d" % (MILLIS // 1000))
sleep(1000)
count += 1
print(“in the loop”)

main()