Advertisement
Guest User

Untitled

a guest
Feb 11th, 2014
738
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import time
  3. import pifacedigitalio as pf
  4.  
  5. pf.init()
  6. last_door_open = None
  7.  
  8. while True:
  9.     door_open = pf.digital_read(0)
  10.     if door_open != last_door_open:
  11.         last_door_open = door_open
  12.         print 'Door', 'opened' if door_open else 'closed'
  13.  
  14.     time.sleep(.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement