Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bottle import route, run, template
- from gpiozero import LED
- from time import sleep
- buzzer = LED(4)
- @route('/hello/<name>')
- def index(name):
- return template('<b>Hello {{name}}</b>!', name=name)
- @route('/buzzer/magic')
- def magic():
- buzzer.blink(0.5,0.5,1)
- return ('You have buzzed open building door')
- #@route('/buzzer/on')
- #def on():
- # buzzer.on()
- # return ('Be careful! You might fry the intercom')
- @route('/buzzer/off')
- def off():
- buzzer.off()
- return ('This is to ensure that no electricity is flowing through the buzzer')
- run(host='192.168.1.109', port=4000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement