Skip to content

Instantly share code, notes, and snippets.

@dbrgn
Last active February 9, 2024 19:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbrgn/77d984a822bfc9fddc844f67016d0f7e to your computer and use it in GitHub Desktop.
Save dbrgn/77d984a822bfc9fddc844f67016d0f7e to your computer and use it in GitHub Desktop.
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