Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5359

Advanced users • Re: Moving Linux Kernel to 6.6

$
0
0
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:

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)
To:

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



Viewing all articles
Browse latest Browse all 5359

Trending Articles