Skip to content

Instantly share code, notes, and snippets.

@HackerEarthBlog
Created February 9, 2017 07:52
Show Gist options
  • Save HackerEarthBlog/191861f2ddade4b424b9ee692fe96302 to your computer and use it in GitHub Desktop.
Save HackerEarthBlog/191861f2ddade4b424b9ee692fe96302 to your computer and use it in GitHub Desktop.
python on raspberry pi
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
while True:
if(GPIO.input(23) ==1):
print(“Button 1 pressed”)
if(GPIO.input(24) == 0):
print(“Button 2 pressed”)
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment