else if (MainDepartureState == LOW && MainArrivalState == LOW) {
if (startupMain == HIGH) {
// pulse turnout for Main train
digitalWrite(Main_Turnout, HIGH);
relayDelay();//<-----1
digitalWrite(Main_Turnout, LOW);
if (deBug == HIGH) {
Serial.println("The Main Turnout Activated");
}
// Engage Motor for Main
motors.setSpeedB(minSpeedB); // Start Motor for Main
motors.forwardB();
PowerMain = LOW;
startupMain = LOW;
delay(300000);//<----2
if (deBug == HIGH) {
Serial.println("Motor Delay Complete");
}
According to what I have read “The delay() function allows you to pause the execution of your Arduino code for a specified period.”
Why are the delays I am using not working or the values are so extreme? How can I best accomplish a delay?
I tried using the delay() function at point <----1 in my code and it failed miserably. I wanted to activate a relay by turning it on, waiting for relay to engage (delay(2000), then turn it off. The delay(2000) two seconds didn’t work. I wrote a little relay routine that accomplish what I wanted but why did delay(2000) not give me two seconds?
I am using delay() function at <----2 in the code but the value doesn’t reflect the actual delay. I needed to generate some wait time for the motor to engage and trigger a sensor. My desire was a three second delay(3000) but the delay(300000) was a value that actually worked. That would be 300 seconds yes/no?
I'm a code resurrectionist and not an actual programmer. I will try and muddle through discussions