Skip to content

Commit

Permalink
adding pull_up true to GPIO #259
Browse files Browse the repository at this point in the history
  • Loading branch information
MiczFlor committed Oct 25, 2018
1 parent 1753a4c commit fa17f14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/GPIO-BUTTONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ You will be running wires from the RPi board to another board where the buttons

On the above image you can also see the pin numbering, in this case containing both: the RPi board numbering on the RPi3 and the Broadcom (BCM) pin numbering used for the code.

The [script for the GPIO buttons](../misc/sampleconfigs/gpio-buttons.py.sample) we are using originally been provided by Andreas aka [hailogugo](https://github.com/hailogugo). It's been modified since then and a [second script version](../misc/sampleconfigs/gpio-buttons.py.sample-2) now provides `pull_up=True` for all pins (not incl. shutdown).
The [script for the GPIO buttons](../misc/sampleconfigs/gpio-buttons.py.sample) we are using originally been provided by Andreas aka [hailogugo](https://github.com/hailogugo). It's been modified since then and now provides `pull_up=True` for all pins (not incl. shutdown). Read more in this thread [why we added `pull_up`](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/259).

Here is how to connect the buttons:

Expand Down
14 changes: 9 additions & 5 deletions misc/sampleconfigs/gpio-buttons.py.sample
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ from gpiozero import Button
from signal import pause
from subprocess import check_call

# 2018-10-15
# this script has the `pull_up=True` for all pins. See the following link for additional info:
# https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/259#issuecomment-430007446
#
# 2017-12-12
# This script was copied from the following RPi forum post:
# https://forum-raspberrypi.de/forum/thread/13144-projekt-jukebox4kids-jukebox-fuer-kinder/?postID=312257#post312257
Expand Down Expand Up @@ -31,12 +35,12 @@ def def_halt():
check_call("./scripts/playout_controls.sh -c=playerpause", shell=True)

shut = Button(3, hold_time=2)
vol0 = Button(13)
vol0 = Button(13,pull_up=True)
volU = Button(16,pull_up=True)
volD = Button(19,pull_up=True)
next = Button(26)
prev = Button(20)
halt = Button(21)
next = Button(26,pull_up=True)
prev = Button(20,pull_up=True)
halt = Button(21,pull_up=True)

shut.when_held = def_shutdown
vol0.when_pressed = def_vol0
Expand All @@ -46,4 +50,4 @@ next.when_pressed = def_next
prev.when_pressed = def_prev
halt.when_pressed = def_halt

pause()
pause()
53 changes: 0 additions & 53 deletions misc/sampleconfigs/gpio-buttons.py.sample-2

This file was deleted.

0 comments on commit fa17f14

Please sign in to comment.