Created
August 8, 2020 15:00
-
-
Save ggarber/cc0fba7d258f7c193aac8094bcd4eb35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from flask import Flask | |
from gpiozero import LED | |
app = Flask(__name__) | |
leds = { | |
'ggb': LED(17), | |
'ler': LED(27) | |
} | |
@app.route('/<room>/<action>') | |
def room_action(room, action): | |
l = leds[room] | |
if action == 'on': l.on() | |
else: l.off() | |
return 'okie dokie' | |
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 5000))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment