raspiled/webapp.py

34 lines
511 B
Python

#!/usr/bin/env python3
# encoding: utf-8
from flask import Flask
import led
app = Flask(__name__)
@app.route('/')
def index():
return "Benvenuto nel raspberry."
@app.route('/accendi')
@app.route('/on')
def accendi() -> None:
led.pin_on()
@app.route('/spegni')
@app.route('/off')
def spegni() -> None:
led.pin_off()
@app.route('/toggle')
def toggle() -> None:
led.toggle()
@app.route('/lampeggia')
def lampeggia():
led.lampeggia()
if __name__ == '__main__':
led.setup()
app()