Skip to content

Instantly share code, notes, and snippets.

@WebSamuraiDaisuke
Created October 6, 2015 07:55
Show Gist options
  • Save WebSamuraiDaisuke/6459bdc0cdfa8ce0a7e2 to your computer and use it in GitHub Desktop.
Save WebSamuraiDaisuke/6459bdc0cdfa8ce0a7e2 to your computer and use it in GitHub Desktop.
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(23)
if input_state == True:
print('Button is NOT Pressed')
time.sleep(0.2)
elif input_state == False:
print('Button is Pressed')
time.sleep(0.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment