Skip to content Skip to sidebar Skip to footer

This Constructor Takes No Arguments Lcd

This is the code that I am trying to display humidity sensor data to my lcd... When I run this program, Traceback(most recent call last): File 'lcd.py', line 7 in lcd

Solution 1:

Not sure which version of RPLCD you are using, but in the current stable version it says that using RPLCD.CharLCD directly is deprecated. Try switching the import statement to

fromRPLCD.gpioimportCharLCD

More documentation here

Solution 2:

I got the same error as well. But realized that I was running python2. After installing latest version of RPLCD and running as python3 following worked:

from RPLCD import CharLCD
import RPi.GPIO as GPIO

lcd = CharLCD(cols=16, rows=2, pin_rs=37, pin_e=35,
              pins_data=[33, 31, 29, 23], numbering_mode=GPIO.BOARD)
# please note that numbering_mode can not be None in latest version of RPLCD

lcd.write_string(u'Hello World')

Output:Displaying "hello World" in LCD

LCD displaying Bus Timing in SG

Post a Comment for "This Constructor Takes No Arguments Lcd"