Start / end events using milis
Your code is somewhat confusing, probably because it has too many
variables. For doing what you describe, the program only needs to
remember two things:


is the relay in the ON state or in the OFF state?
when was the last time the relay changed state?


These can be represented as follows:



bool relay_is_on = false;
unsigned long last_relay_change = 0;


Then, I recommend you use descriptive names for your variables and
constants. Calling a constant threeSeconds is not useful. It has no
added value over just typing 3000. Having the constant named
RELAY_ON_TIME makes it a lot clearer what it is intended for. It is a
common convention to name the constants with all caps to make them stand
out relative to variables:

const uint8_t RELAY_PIN = ...;
const unsigned long RELAY_ON_TIME  =  3000;  //  3 s ON
const unsigned long RELAY_OFF_TIME = 10000;  // 10 s OFF


With this in place, periodically switching the relay on and off can be
achieved as follows:

void loop()
{
    unsigned long now = millis();
    if (relay_is_on &amp;&amp; now - last_relay_change &gt;= RELAY_ON_TIME) {
        // Turn off.
        digitalWrite(RELAY_PIN, LOW);
        relay_is_on = false;
        last_relay_change = now;
    }
    if (!relay_is_on &amp;&amp; now - last_relay_change &gt;= RELAY_OFF_TIME) {
        // Turn on.
        digitalWrite(RELAY_PIN, HIGH);
        relay_is_on = true;
        last_relay_change = now;
    }
}