ultrasonic sensor not setting off relays

im using an arduino uno with relays on pins 2, 3, 4, and 5 and a ultrasonic sensor on pins 6 and 7 and I have it set up where the relays should go off when the sensor is less than 24 inches but it doesn’t set off the relays(code is below) can anybody help?

const int pingPin = 7; // Trigger Pin of Ultrasonic Sensor
const int echoPin = 6; // Echo Pin of Ultrasonic Sensor
const int relayPins[4] = {2, 3, 4, 5};
void setup() {
   Serial.begin(9600); // Starting Serial Terminal
  for(int i = 0; i >= 4; i++){
  	pinMode(relayPins[i], OUTPUT);
  }
}

void loop() {
   double duration, inches, cm;
   double feet = inches*12;
   pinMode(pingPin, OUTPUT);
   digitalWrite(pingPin, LOW);
   delayMicroseconds(2);
   digitalWrite(pingPin, HIGH);
   delayMicroseconds(10);
   digitalWrite(pingPin, LOW);
   pinMode(echoPin, INPUT);
   duration = pulseIn(echoPin, HIGH);
   inches = microsecondsToInches(duration);
   cm = microsecondsToCentimeters(duration);
   Serial.print(inches);
   Serial.print("in, ");
   Serial.print(cm);
   Serial.print("cm");
   Serial.println();
  if(inches <= 24){
  
  	digitalWrite(relayPins[0], HIGH);
    digitalWrite(relayPins[1], HIGH);
    digitalWrite(relayPins[2], HIGH);
    digitalWrite(relayPins[3], HIGH);
  
  } else {
  digitalWrite(relayPins[0], LOW);
    digitalWrite(relayPins[1], LOW);
    digitalWrite(relayPins[2], LOW);
    digitalWrite(relayPins[3], LOW);
  }
   delay(100);
}

double microsecondsToInches(double microseconds) {
   return microseconds / 74 / 2;
}

double microsecondsToCentimeters(double microseconds) {
   return microseconds / 29 / 2;
}
  for(int i = 0; i >= 4; i++){
  	pinMode(relayPins[i], OUTPUT);
  }

It would be worth checking how the parameters to for() actually work (hint, 0 is not >=4).

Steve

thank you very much, i guess i made a very stupid mistake.

We all make simple errors from time to time. Experience doesn't stop that, it just lets you find the errors more quickly.

Steve

And just make sure you don’t dofor(int i = 0; i <= 4; i++)