Quantcast
Viewing all articles
Browse latest Browse all 1241

Python • Re: RuntimeError: Failed to add edge detection

I have tried all of you suggestions and installed rpi-lgpio and I get this error

Code:

Traceback (most recent call last):File "/root/speedometer/main.py", line 4, in <module>import RPi.GPIO as GPIOFile "/root/.venv/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 927, in <module>RPI_INFO = _get_rpi_info()File "/root/.venv/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 428, in  _get_rpi_inforaise NotImplementedError(NotImplementedError: This module does not understand old-style revision codes
I'm running it on a Raspberry Pi 3 B+ on 32 bit Bookworm
This is my code:

Code:

from RPLCD.i2c import CharLCDimport RPi.GPIO as GPIOimport timelcd = CharLCD(i2c_expander='PCF8574', address=0x3f, port=1, cols=16, rows=2, dotsize=8)lcd.clear()GPIO.setwarnings(False) # Ignore warning for nowGPIO.setmode(GPIO.BOARD) # Use physical pin numberingGPIO.setup(12, GPIO.OUT)def button_callback(channel):    lcd.clear()    GPIO.output(12, GPIO.HIGH)    lcd.write_string("lys tændt")    time.sleep(1)    lcd.clear()    GPIO.output(12, GPIO.LOW)    lcd.write_string("lys slukket")GPIO.setup(29, GPIO.IN, pull_up_down=GPIO.PUD_OFF)GPIO.add_event_detect(29, GPIO.PUD_DOWN, callback=button_callback) GPIO.cleanup()lcd.clear()

Statistics: Posted by IT-smurf — Thu Mar 06, 2025 11:36 am



Viewing all articles
Browse latest Browse all 1241

Trending Articles