raspberry pi pico w using gpio input via interrupt while running a webserver #13665
-
I am trying to get input from a TCRT5000 infra-red detector on GPIO pin 15, via an interrupt routine - that works OK. Then I added code to use the socket library to run small webserver and display the condition of the GPIO pin detected in the interrupt routine, via a global variable. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi |
Beta Was this translation helpful? Give feedback.
And for asyncio, see https://github.com/peterhinch/micropython-async
Interrupts can be tricky. To check a sensor it's normally easier to start a second asyncio task with asyncio.create_task, with a loop to poll the sensor and asyncio.sleep_ms between 10 ms to 1 sec or more depending on what you want to achieve. This task will then run in parallel to the microdot server