If your relays are "active-low", you can avoid momentary ON glitches by setting the output state BEFORE you set the pin to an output:
digitalWrite(pin, HIGH);
pinMode(pin, OUTPUT);
If your relays are "active-low", you can avoid momentary ON glitches by setting the output state BEFORE you set the pin to an output:
digitalWrite(pin, HIGH);
pinMode(pin, OUTPUT);