ChatGPT does not know how flask works, if you want to get this working, you will have to.
The GPIO was indeed busy from a previous run before flask restarted by a code change you made clearly seen by the output you provided.
So read flask docs and learn how that works. Then you'll need to make sure your GPIO subsystem is cleanly shutdown before flask will work correctly. Easier said than done, so my tip for you is to cleanly stop the web service before you make code changes then start it back up.
The GPIO was indeed busy from a previous run before flask restarted by a code change you made clearly seen by the output you provided.
The error happened after the restart.
...
* Restarting with stat
Traceback (most recent call last):
File "/home/****/Desktop/neww/app.py", line 13, in <module>
lgpio.gpio_claim_output(h, LEFT_MOTOR_PIN)
File "/usr/lib/python3/dist-packages/lgpio.py", line 781, in gpio_claim_output
return _u2i(_lgpio._gpio_claim_output(handle&0xffff, lFlags, gpio, level))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i
raise error(error_text(v))
lgpio.error: 'GPIO busy'
So read flask docs and learn how that works. Then you'll need to make sure your GPIO subsystem is cleanly shutdown before flask will work correctly. Easier said than done, so my tip for you is to cleanly stop the web service before you make code changes then start it back up.
Statistics: Posted by memjr — Sun Jan 05, 2025 7:48 pm