diff --git a/webapp.py b/webapp.py index dc4f152..b76d57d 100644 --- a/webapp.py +++ b/webapp.py @@ -19,11 +19,14 @@ def accendi(): return "LED Spento." - @app.route('/spegni') @app.route('/off') def spegni(): led.pin_off() + if led.stato_pin(): + return "LED acceso." + + return "LED spento." @app.route('/toggle') def toggle(): @@ -33,12 +36,12 @@ def toggle(): return "Il LED รจ spento." - @app.route('/lampeggia') def lampeggia(): led.lampeggia() return "LED ha lampeggiato." if __name__ == '__main__': - led.setup() - app() + with app.app_context(): + led.setup() + app.run()