Based on the rotational speed of a external shaft i need a stepper motor to either turn CW or CCW.
Every 15 seconds the rpm of a shaft is read.
Above 100rpm, the stepper turns CW by 15 degrees then stops.
If the rpm of the shaft remains, or greater than 100rpm, the stepper turns CW again by 15 degrees and stops.
If the rpm of the shaft fall below 100rpm, the stepper turns CCW by 15 degrees then stops.
If the rpm of the shaft remains below 100rpm the stepper turns CCW again than stops.
In both directions (CW and CCW) there is a limit switch that only allows the stepper to rotate 90 degrees in total.
I have found the code for counting the rmp of the shaft using a Photo interrupter and i have found the code for controlling stepper motors.
Combining these 2 codes or adding the 'last rpm read' or 'delay periods' is beyond me.
If there is a tutorial on this id be happy to study it.
If someone could write this code or point me in the right direction it would be much appreciated.
Well, first of all if your stepper is the common 200 steps per rev type, it cannot turn 15 degrees it can turn 14.4 degrees (8 steps) or 16.2 degrees (9 steps), do you want to continue?
Hi,
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.