(Solved) ir remote relay control

What is the problem?

Isn't it working if you do...

else if (results.value == WHATEVER) {
  if (millis() - last > 250) {
    on2 = !on2;
    digitalWrite(relay2, on2 ? HIGH : LOW);
  }
  last = millis();
}

?

Also a little tip, change:

int relay1 = 4;
...
int on = 0;
...
on = !on;
digitalWrite(relay1, on ? HIGH : LOW);

to

byte relaysPins[] = { 4, 5, 6, 7 }; //assuming relays are connected to those pins...
...
bool relaysStates[] = { LOW, LOW, LOW, LOW };
...
relaysStates[0] = !relaysStates[0];
digitalWrite(relaysPins[0], relaysStates[0]);

etc... Well, only a suggestion :wink: