If you want your motors to turn on and stay on for 25 minutes, and then turn off and continue with your code, you can do something like this:
const unsigned X_AXIS_PIN = 0;
const unsigned Y_AXIS_PIN = 1;
const unsigned Z_AXIS_PIN = 2;
const int motor1 = 3;
const int motor2 = 5;
const int motor3 = 10;
int motorState = LOW;
long delay25minutes = 1500000; // delay for 25 minutes, which is 1500 seconds
void setup()
{
Serial.begin(9600);
pinMode(motor1, OUTPUT);
pinMode(motor2, OUTPUT);
pinMode(motor3, OUTPUT);
}
int x,
y,
z;
void loop()
{
Serial.print(analogRead(X_AXIS_PIN));
Serial.print(" ");
x = analogRead(X_AXIS_PIN);
Serial.print(analogRead(Y_AXIS_PIN));
Serial.print(" ");
y = analogRead(Y_AXIS_PIN);
Serial.println(analogRead(Z_AXIS_PIN));
z = analogRead(Z_AXIS_PIN);
delay(5000);
if( x < 700 && y < 700 && z < 700)
{
if (motorState == LOW)
motorState = HIGH;
else
motorState = LOW ;
digitalWrite(motor1, motorState);
digitalWrite(motor2, motorState);
digitalWrite(motor3, motorState);
delay(delay25minutes);
motorState = LOW;
digitalWrite(motor1, motorState);
digitalWrite(motor2, motorState);
digitalWrite(motor3, motorState);
}
}
If you want your Arduino to be doing some other code during the 25 minutes, then you need the blink without delay approach.