Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. import time
  3. import datetime
  4. PIR = 23
  5. LED = 18
  6.  
  7. GPIO.setmode(GPIO.BCM)
  8. GPIO.setup(PIR, GPIO.IN)
  9.  
  10. while True:
  11. localtime = time.asctime( time.localtime(time.time()) )
  12. if GPIO.input(PIR):
  13. GPIO.setup(LED, GPIO.OUT)
  14. GPIO.output(LED, True)
  15. print "Wykrylem Ruch :", localtime
  16. time.sleep(2)
  17. GPIO.setup(LED, GPIO.IN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement