From d1d02e13b38246e08bc6ba00d019d359992f14de Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Wed, 4 Sep 2024 17:11:19 +0200 Subject: [PATCH] Verifica inizializzazione GPIO su raspberry. --- webapp.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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()