def control(): if request.method == 'POST': if request.form['submit'] == 'Do Something': gpio.blink(10,1) elif request.form['submit'] == 'Do Something Else': gpio.blink(10,1) return render_template('control.html')
def request(): gpio.blink() data = {} for d in bottle.request.json: data[d["name"]] = float(d["value"]) / 100.0 droplets.set(data) bottle.response.content_type = "application/json" return json.dumps("success")
def gif(bot, update): logger.warning(get_user_name(update) + " - gif") update.message.reply_text("Gravando gif!") gpio.blink(gpio.BLUE, 5) video.record_gif(update, 5)
def photo(bot, update): logger.warning(get_user_name(update) + " - photo") gpio.blink(gpio.WHITE, 2) video.capture(dash.CAPTURE_FILE) update.message.reply_photo(photo=open(dash.CAPTURE_FILE, 'rb'))
def cade(bot, update): logger.warning(get_user_name(update) + " - cade") gpio.blink(gpio.YELLOW, 2) entry = gpsdaemon.get_last_entry() update.message.reply_location(entry["lat"], entry["lon"])
import wlanauto import webserver import gpio import webrepl # import webapp ssid = "" password = "" wlan = wlanauto.get_connection(ssid,password) if wlan is None: print("Could not initialize the network connection.") wlan = wlanauto.ap(True) gpio.blink(0) else: gpio.on() print("ESP OK") ip = wlan.ifconfig() print(ip) print(ip[0]) wlanauto.ap(True) webrepl.start() # wlanauto.forward() webserver.app.run(debug=-1, host=ip[0]) # webapp.app.run(debug=-1, host=ip[0])
def engine(filename): gpio.blink() data = {"title": filename} return bottle.template('www/edit', data=data)
def index(): gpio.blink() data = {"title": "StripRevolution Control"} return bottle.template('www/index', data=data)