Hello all,
I have been tinkering around with a fairly small stepper motor. I have my arduino running a temperature sensor, LCD, and hbridge for the bipolar (4 pin) stepper motor. The code I have runs the temperature sensor value every 2 seconds and has an if statement that will run the stepper motor at 78 rpm for a fixed amount of steps. My only problem is that I am doing all of this in the void loop, so it will run the command to have the motor run, but if the temp remains in the correct range it will run the loop over again.
[
if(temperatureF >= tempFStart)
{
myStepper.setSpeed(0);
myStepper.step(0);
}
else
{
myStepper.setSpeed(78); //motor travels at roughly 0.5 inches/4 seconds
myStepper.step(375); //motor turns 375 steps = 1.5 inches traveled
}
]
My question is how do I make it so the program will run through and activate the motor when it reaches a certain degree range and stop?
My other question is how can I make the motor stay where it is until the temperature sensor value goes back to within range? Can I make the motor return to 0 position?
Again, the segment of code I provided is within a void loop.
Any help or tips would be very much appreciated 8)