Verifica inizializzazione GPIO su raspberry.

This commit is contained in:
Emiliano Vavassori 2024-09-04 17:11:19 +02:00
parent eb33823e80
commit d1d02e13b3

View File

@ -19,11 +19,14 @@ def accendi():
return "LED Spento." return "LED Spento."
@app.route('/spegni') @app.route('/spegni')
@app.route('/off') @app.route('/off')
def spegni(): def spegni():
led.pin_off() led.pin_off()
if led.stato_pin():
return "LED acceso."
return "LED spento."
@app.route('/toggle') @app.route('/toggle')
def toggle(): def toggle():
@ -33,12 +36,12 @@ def toggle():
return "Il LED è spento." return "Il LED è spento."
@app.route('/lampeggia') @app.route('/lampeggia')
def lampeggia(): def lampeggia():
led.lampeggia() led.lampeggia()
return "LED ha lampeggiato." return "LED ha lampeggiato."
if __name__ == '__main__': if __name__ == '__main__':
led.setup() with app.app_context():
app() led.setup()
app.run()