Robot turning code

i don't see any code that sets "turn" to true

f

i don't see how the 2nd test of Ms - previousTime >= eventTime can ever be true since previousTime is just set to Ms

seems like you should have a state machine and a timer which advances the state each time the timer expires. each state can set the directions (speed?) of the motors

consider


#define MaxState = 3
int           state;

#define Period  1000
unsigned long msecLst;

// -----------------------------------------------------------------------------
void
loop ()
{
    unsigned long msec = millis ();

    if ((msec - msecLst) < Period)
        return;

    msecLst = msec;

    switch (state)  {
    case 0:
        Serial.println ("state 0");
        state++;
        break;

    case 1:
        Serial.println ("state 1");
        state++;
        break;
    case 2:
        Serial.println ("state 2");
        state = 0;
        break;
    }
}

// -----------------------------------------------------------------------------
void setup () {
    Serial.begin (9600);
}