Stepper motor runs simultaneous with reading a sensor

Hello everyone,
I wanna know how to run stepper motor( Nema17 with drv8825) simultaneous with reading a sensor. I wanna run motor continuously until a water level give a reading and then stops. I need to use , between these water level sensor, 2 pressure sensors an one rpm sensor , and do somehow all measurements when motor is running. I am using Arduino board. Can i do this somehow?

Thanks you.

Tell us about your software and hardware experience.

Read this:

There are really many very different arduino boards . Which one are you using?
If you are using one of the supported processors/boards you could use my MobaTools lib. It runs the stepper in the background so you can do what you like in your sketch while the motor is moving. See the example minimumStepper. The loop is empty, but the motor will be running. You can stop and start it at any time. You don't have to bother with step generation in the loop.
MobaTools can be installed by means of the library manager.

My tutorial Multi-tasking in Arduino covers that in detail with complete stepper example that is controlled by both user input and a temperature sensor.
MobaTools is a nice alternative also :slight_smile: but you may still need to use multi-tasking in the loop() to handle other actions.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.