Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as gpio
- import time
- import os
- #adjust for where your switch is connected
- buttonPin = 17
- gpio.setmode(gpio.BCM)
- gpio.setup(17, gpio.IN)
- while True:
- input_value = gpio.input(17)
- if input_value == False:
- print('The button pressed')
- while input_value == False:
- input_value = gpio.input(17)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement