HTML

alarm.py

Nov 18th, 2016
163
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. # Car alarm
  2. # The finch sounds an alarm, alternating high pitch sounds and
  3. # flashing red abd blue lights, until its nose is turned up
  4.  
  5. from time import sleep
  6. from finch import Finch
  7.  
  8. finch = Finch()
  9. x = 0
  10. while x > -0.5:
  11.     x, y, z, tap, shake = finch.acceleration()
  12.  
  13.     finch.led("#FF0000") # set the led to red
  14.     finch.buzzer(1.0, 250)
  15.     sleep(1.05)
  16.     finch.led("#0000FF") # set the led to blue
  17.     finch.buzzer(1.0, 400)
  18.     sleep(1.05)
  19.  
  20. finch.halt()
  21. finch.close()
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment