Last active
March 25, 2017 15:27
-
-
Save chowmean/be982de138cb5f07ff5f8abd97e52e1c to your computer and use it in GitHub Desktop.
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 | |
| import time | |
| if __name__ == "__main__": | |
| pir_sensor = 13 #sensor pin number | |
| led_pin = 7 #led pin nunmber | |
| GPIO.setmode(GPIO.BOARD) | |
| GPIO.setup(pir_sensro,GPIO.IN) | |
| GPIO.setup(led_pin,GPIO.OUT) | |
| while(True): | |
| time.sleep(1) | |
| current_state = GPIO.input(pir_sensor) | |
| if current_state: | |
| GPIO.output(LEDPin, True) | |
| time.sleep(1) | |
| GPIO.output(LEDPin, False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment