Skip to content

Instantly share code, notes, and snippets.

@ggarber
Created August 8, 2020 15:00
Show Gist options
  • Save ggarber/cc0fba7d258f7c193aac8094bcd4eb35 to your computer and use it in GitHub Desktop.
Save ggarber/cc0fba7d258f7c193aac8094bcd4eb35 to your computer and use it in GitHub Desktop.
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