Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import time
- import pifacedigitalio as pf
- pf.init()
- last_door_open = None
- while True:
- door_open = pf.digital_read(0)
- if door_open != last_door_open:
- last_door_open = door_open
- print 'Door', 'opened' if door_open else 'closed'
- time.sleep(.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement