Linked Questions

Popular Questions

NameError: Name ‘r’ is not defined

Asked by At

My code is:

import pigpio
from RPLCD.gpio Import CharLCD
lcd = CharLCD

pi = pigpio.pi()
lcd.write_string(r, “Hello World!”)

I get the error:

Traceback (most recent call last):
    File “/home/pi/Documents/”, line 6, in <module>
        lcd.write_string(r, “Hello World”) NameError: Name ‘r’ is not defined

I want to make ‘Hello World’ appear on my lcd screen (16x2). If I remove the r it says

TypeError: unbound method write_string() must be called with CharLCD instance as first argument

Related Questions