示例#1
0
文件: flask1.py 项目: QAQMiao/Flask
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")
示例#3
0
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)
示例#4
0
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'))
示例#5
0
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"])
示例#6
0
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)