What is the interrupt callback function argument “channel” and is it needed?
I know there is an interrupt library that is better than the Python interrupt. For the like I can not remember its name. (blushing face)
What is the interrupt callback function argument “channel” and is it needed?
I know there is an interrupt library that is better than the Python interrupt. For the like I can not remember its name. (blushing face)
Is your question about the Raspberry Pi and its RPi.GPIO
library?
If yes, the channel
argument refers to the pin number, using either physical or BCM numbering depending on how you called setmode()
. And the other library you are looking for is probably gpiozero
.
Yes, I’m running Python app on a Raspberry PI 3+ and I am using board numbers for the GPIO pins. (the RPi.GPIO
library).
I want to use GPIOzero, but I do not understand how to use it.
gpiozero
has a very friendly tutorial page:
Yes, that’s a great link. Thanks
Here are the board numbers (yes I have to convert them BCM pins) and the setmode for the current GPIO pins.
#=== Set GPIO Pins ===
Toy_Sel_Pins = (8,10)
Abort_Out_Pin = 12
Run_Pin = 16
DIR_Pin = 10
IntensitySelect_Pins = (32,26,24,22) # Tell contrler task value
Busy_Pin = 36
BUZZER_Pin = 38
PWR_LED_Pin = 35
Abort_IN_Pin = 33
Ready_LED_Pin = 40
# Initialize the GPIO pins
GPIO.setmode(GPIO.BOARD)
# Input pins
GPIO.setup(Busy_Pin, GPIO.IN)
GPIO.setup(Abort_IN_Pin, GPIO.IN)
# Output pins
GPIO.setup(Run_Pin, GPIO.OUT)
GPIO.setup(Toy_Sel_Pins, GPIO.OUT)
GPIO.setup(Abort_Out_Pin,GPIO.OUT)
GPIO.setup(DIR_Pin,GPIO.OUT)
GPIO.setup(IntensitySelect_Pins,GPIO.OUT)
GPIO.setup(BUZZER_Pin,GPIO.OUT)
GPIO.setup(PWR_LED_Pin,GPIO.OUT)
GPIO.setup(Ready_LED_Pin,GPIO.OUT)
GPIO.setup(BUZZER_Pin,GPIO.OUT)
My problem is what GPIOzero command do I use? From the link I see LED and Button define but I need the GPIO names (define above) to make the code more readable. Also looking at the advance recipes there are a lot of them I just do not use for this app.