Close

Reset Button

A project log for Audible notifications by a Grandfather's clock

Eight chimes can sound in different patterns whenever I receive a notification through IFTTT

borazsloborazslo 05/14/2016 at 21:270 Comments

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