Motorcontrolling through interrupts?

Hi all I've set up a 'positioner' with 3 axis, stepper-motors, motordrivers and an Arduino Mega to control it all. I've just tested the setup to see if the parts works together. I figure, that I'm going to involve an unknown set of sensors and buttons too, but realize that there'll be a lot of .. 'polling' if that's the right word. It's tempting to try to involve an interrupt instead .. I mean, most of the time everything is just waiting for a stepper delay(somemillis) to finish. I cann't help thinking that a quick interrupt that flips the stepper-fases .. then the controller is free to dash around to check the sensors and whatelse instead of being blocked by a delay. Has anyone tried or have some input to the notion?

Carsten

Yes this is the proper way to control a stepping motors. Using delay() is just for demos.

Hi Grumpy

Something didn’t feel right about that delay so I had a closer look. The code is quite new and indeed it turns out to be no problem to bypass the delay and use the free time to loop/godo instead.

Carsten