As a by product of the change in the GPIO mentioned on this thread, on Kernel 6.6, RPI.GPIO is deprecated and instead gpiozero or gpiod are recommended. I am only going to cover gpiozero briefly since it is recommended by Raspberry Pi.
gpiozero: https://gpiozero.readthedocs.io/en/latest/
gpiod: https://pypi.org/project/gpiod/
If you use RPi.GPIO python library or other implementations, you have to update your application code to use gpiozero. You should checkout each tool documentation but in essence you need to replace these lines:
From:
To:
gpiozero: https://gpiozero.readthedocs.io/en/latest/
gpiod: https://pypi.org/project/gpiod/
If you use RPi.GPIO python library or other implementations, you have to update your application code to use gpiozero. You should checkout each tool documentation but in essence you need to replace these lines:
From:
Code:
import RPi.GPIO as GPIOGPIO.setmode(GPIO.BCM)GPIO.setup(5, GPIO.IN, pull_up_down=GPIO.PUD_UP) // 5 refers to BCM pin number: GPIO5 GPIO.add_event_detect(INT_EXPANPER,GPIO.FALLING,callback=foo,bouncetime=1)
Code:
from gpiozero import Buttonbtn = Button(5)btn.when_pressed=foo// btn.when_released=foo for GPIO.RISING
Statistics: Posted by ubopod — Sat Mar 16, 2024 3:34 am