Hello, I am really struggling to get anywhere with usage of GPIO on a jetson Xavier NX with fresh image (5.1.3)… I am using the python library Jetson.GPIO
I need to read a button press… but I have tried everything without success
for example, using pin 12 (which I understand is pulled down by default reading the specs https://download.kamami.pl/p579520-Jetson_Xavier_NX_DevKit_Carrier_Board_Specification_v1.0.pdf
but even if I use a pull up as below:
import time
# Define the GPIO pin number
BUTTON_PIN = 18 # Change to the GPIO pin you are using
# Set up the pin as an input with an internal pull-up resistor
GPIO.setmode(GPIO.BCM) # Use BCM numbering
GPIO.setup(BUTTON_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
try:
while True:
if GPIO.input(BUTTON_PIN) == GPIO.LOW: # Button pressed (pulled to ground)
print("Button Pressed!")
else:
print("Button Released!")
time.sleep(0.1) # Debounce delay
except KeyboardInterrupt:
print("\nExiting...")
finally:
GPIO.cleanup() # Reset GPIO settings```
The pin seems to be floating, ie if connected to 3.3v it goes HIGH, if connected to GND it goes LOW, but it never goes back to LOW by itself...
I have few limit switch to monitor, I would like to avoid doing the pull down externally...
I have not tested successfully on terminal, I don't get how to do that, the command cat /sys/kernel/debug/gpio does not show for example the pin 199... which, if I understand correctly, is connected to pin 12 on the board.
Can someone help me?
Thank you