Skip to content

Instantly share code, notes, and snippets.

@dbrgn
Last active March 23, 2018 16:19
Embed
What would you like to do?
RPLCD numbering mode notes

In RPLCD version 1.0, some APIs were slightly changed. Previously the CharLCD instance would provide default values for the pin numbers and the numbering mode. But that was changed, since it may be dangerous if these pins are connected to other hardware.

So if you have installed version 1.0 of RPLCD, you need to provide the pin numbering mode yourself. If your code previously looked like this:

from RPLCD import CharLCD
lcd = CharLCD(cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[40, 38, 36, 32, 33, 31, 29, 23])

...and if you use the BOARD numbering scheme, then change the code like this:

from RPLCD import CharLCD
from RPi import GPIO

lcd = CharLCD(numbering_mode=GPIO.BOARD, cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[40, 38, 36, 32, 33, 31, 29, 23])

Regarding the different pin numbering modes, please check out https://raspberrypi.stackexchange.com/q/12966/6793.

If you don't want to deal with these changes, you can also install an older version of RPLCD:

pip install RPLCD==0.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment