Edge detection exception

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
RandyBryant3757
 
Posts: 12
Joined: Sat Aug 27, 2022 4:42 pm

Edge detection exception

Post by RandyBryant3757 »

I am having an issue setting up button detection on the Adafruit 128x64 OLED Bonnet for Raspberry Pi. Pin 15 GPIO 22 gets an exception when setting up the call back. I know the button (joystick down click) works because your demo code works. But I am using GPIO unlike your code. My code and error output is attached.

Also, if I don't sleep for a short time between buttons, other buttons fail the setup.

This is on a Pi Zero W 1.3 with all updates. I have tried running with sudo, doesn't help.
Attachments
Screen Shot 2023-01-14 at 5.09.53 PM.png
Screen Shot 2023-01-14 at 5.09.53 PM.png (27.1 KiB) Viewed 30 times
Untitled.jpg
Untitled.jpg (72.35 KiB) Viewed 31 times

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Edge detection exception

Post by mikeysklar »

Please work from the provided Python example code. We stopped using RPi.GPIO years ago.

Code: Select all

# Input pins:
button_A = DigitalInOut(board.D5)
button_A.direction = Direction.INPUT
button_A.pull = Pull.UP

button_B = DigitalInOut(board.D6)
button_B.direction = Direction.INPUT
button_B.pull = Pull.UP

button_L = DigitalInOut(board.D27)
button_L.direction = Direction.INPUT
button_L.pull = Pull.UP

button_R = DigitalInOut(board.D23)
button_R.direction = Direction.INPUT
button_R.pull = Pull.UP

button_U = DigitalInOut(board.D17)
button_U.direction = Direction.INPUT
button_U.pull = Pull.UP

button_D = DigitalInOut(board.D22)
button_D.direction = Direction.INPUT
button_D.pull = Pull.UP

button_C = DigitalInOut(board.D4)
button_C.direction = Direction.INPUT
button_C.pull = Pull.UP
Next up we define the pins that are used for the joystick and buttons. The Joystick has Left, Right, Center (press in), Up and Down. There's also the A and B buttons on the right. Each one should be set as an input with pull-up resistor (Pull.UP in the code)
https://learn.adafruit.com/adafruit-128 ... up-3024382

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”