The RPi sometimes loses its internet-connection, and I need to reset to RPi in a safe way. So I added a small GPIO input push button:
Some of the GPIO-s of the RPi has built in pull-up or pull-down, so I did not use external pull-up/down circuit. I put the button to HeaderPin 7 (GPIO 4) and HeaderPin 9 (GND) and I use a simple code with a special part for the GPIO.setup:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(7)
if input_state == False:
print('Button Pressed')
time.sleep(0.2)
Another advantage of this item that I can use it with both male and female head, and my GND pin remains accessible for other jumper wires.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.