04-20-2024, 07:46 AM
(This post was last modified: 04-22-2024, 07:39 PM by m4th31st.
Edit Reason: Solved!
)
I have an issue where a button (connected to GPIO 26) only works after I manually set pin 26 to be used as pull down, by running the following Python code:
So I thought a workaround would be to run the above script in /etc/rc.local, but this doesn´t solve the problem. I checked that the script is run at startup by adding other lines of code to it.
I connected the button between 3V3 and GPIO 26 (which should be pulled down, so I connected it to the right pins... right?). I also tried other GPIO pins between 9 and 27, but the same problem persists.
Is there a file where I can check (and change) the default mode (pulled up / pulled down) all the pins have after startup? I think I need to change it there.
Code:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
So I thought a workaround would be to run the above script in /etc/rc.local, but this doesn´t solve the problem. I checked that the script is run at startup by adding other lines of code to it.
I connected the button between 3V3 and GPIO 26 (which should be pulled down, so I connected it to the right pins... right?). I also tried other GPIO pins between 9 and 27, but the same problem persists.
Is there a file where I can check (and change) the default mode (pulled up / pulled down) all the pins have after startup? I think I need to change it there.