Event-driven progamming in Pycom



  • Hi everyone,

    I am recently trying to implement event-driven programming in a Pycom LoPy4 device, in the sense that I want it to have one main loop that can receive and send messages to independent "worker" threads to execute certain tasks. The problem I immediatly faced is that using the threading module significantly reduces the function call stack and I was prone to exceed the maximum call stack depth (as I read in other threads on this forum, this seems to be a fairly frequent limitation).

    Is there any feasible way to implement this logic? I was wondering if creating a queue of tasks would be more effective (tasks would be enqueued by the same main loop, and it would check the next task to execute every time the loop starts again). Has anyone implemented a solution similar to this?

    Best,
    Diego


Log in to reply
 

Pycom on Twitter