#running two things at once

1 messages · Page 1 of 1 (latest)

gilded quail
#

So I have an led sequence that I want to run while also stepping my stepper motor, is there a way I can write non blocking code or would the easiest way be to just spread out the stepping within the led sequence code?

buoyant gustBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

novel stag
#

Need more details.

midnight scroll
#

Are you writing code for Arduino or some similar environment or something else? The general ideas is to call a function does one step if a step is due based on desired speed and current position. If no step is due, just return and move your LED sequence along and come back to see if it is time for a new step.

north lance
# novel stag Need more details.

what this guy said. in specific, we need to know the platform you're running on. different platforms have different capabilities. some are only singlethreaded, some are multithreaded, and the raspi pico has state machines you can program to independently perform certain tasks. you might be able to use timers and interrupts depending on what's available to you, but it all depends on what the platform you're running on is