Advertisement
kaly1

Buzzer V1.0

Nov 29th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. from bottle import route, run, template
  2. from gpiozero import LED
  3. from time import sleep
  4.  
  5. buzzer = LED(4)
  6.  
  7. @route('/hello/<name>')
  8. def index(name):
  9. return template('<b>Hello {{name}}</b>!', name=name)
  10.  
  11. @route('/buzzer/magic')
  12. def magic():
  13. buzzer.blink(0.5,0.5,1)
  14. return ('You have buzzed open building door')
  15.  
  16. #@route('/buzzer/on')
  17. #def on():
  18. # buzzer.on()
  19. # return ('Be careful! You might fry the intercom')
  20.  
  21. @route('/buzzer/off')
  22. def off():
  23. buzzer.off()
  24. return ('This is to ensure that no electricity is flowing through the buzzer')
  25.  
  26.  
  27. run(host='192.168.1.109', port=4000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement