I had some trouble with my wait periods so I started looking around. I read that delay() doesn't work very well when you go into second let along minutes.
I'm not a programmer so when I looked at the examples for using MsTime2, it went right over my head. Could you give me a better example of how to use it?
This is built from the basic example code on steppers and put into a function.
Other stuff
#include <MsTimer2.h> //I just added this.
More stuff
int long delayBetweenStations = 1000 * 60 * 10; // Doesn'T WORK? Time to wait before moving to next station
// (1/1000 sec. times 60)=1 minute, times 10= 10 minutes?
// EXTENT, FEED AND CHANGE WATER
void extendAndFeed(int timeForFoodPumping, int timeForWaterPumping) // Pumping times come from a small array. (Code left out)
{
if (timeForFoodPumping == 0 && timeForWaterPumping == 0) // If no pumping is assigned, skip to next tower
{
return; // Go back, skip
}
delay(100); // Wait a about second
Serial.println("Stepper Two - Down - clockwize 100 steps");
myStepperTwo.step(-100); // Drop feeding tube carriage downn into tower openning
delay(100); // Wait a about second
digitalWrite(foodPumpMotorPin, HIGH); // Turn on food pump
delay(timeForFoodPumping); // Wait "timeForFoodPumping" amount of time
digitalWrite(foodPumpMotorPin, LOW); // Turn off food pump
Serial.println(timeForFoodPumping);
delay(1000); // Wait a about second
digitalWrite(waterPumpMotorPin, HIGH); // Turn on water pump
delay(timeForWaterPumping); // Wait "timeForWaterPumping" amount of time
digitalWrite(waterPumpMotorPin, LOW); // Turn off water pump
Serial.println(timeForWaterPumping);
Serial.println("Stepper Two - UP - counterclockwise 100 steps");
myStepperTwo.step(100); // Bring up feeding tube carriage from tower
delay(delayBetweenStations); // This didn't work!
} // End of Move To Station