Created
February 9, 2017 07:52
-
-
Save HackerEarthBlog/191861f2ddade4b424b9ee692fe96302 to your computer and use it in GitHub Desktop.
python on raspberry pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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