Stepper controller

Hi friends, I am building a proyect where I have to control a bipolar motor using microstepping, I found a driver in the web, called Easydriver that can be used for the stepping sequence of the motor, you just need input the direction and the speed for the step with a clock, here is where my question appears, I need to control the speed of the motor, so I need to send a clock signal that is going to be related to the speed that I want for the motor, but at the same time I need to read a 4x4 keypad to input the speed that I want for the motor, so a clock using just delay function doesnt seem to fit my needs, because I have to check the keypad to change the speed of the motor or to stop the motor. The period of the clock that I need is between 200us to 5 sec, any idea about how to do it? Can I program a PWM that works in "background mode"? there is enough time in 200us to check the keypad and make a desicion about the speed of the motor?

I appreciate any comments or suggestions

Andres

sounds like you'd need some sort of clock code based on the millis function. http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay seems somewhat similar to what you are trying to do.

Hi weirdo557, I took a look of the example, it could work, the problem is that I need a very precise control of the time, so maybe doing the timing with an interruption will be better, i was reading the libraries, and it seems that the library Mstimer2 do what I need.

Thanks