Relay Motors and Processing

I am trying to make the relay motor stop and start. The code just starts and stops but does not start again. Can someone please help me understand why the code below is not working?

import processing.serial.*;
import cc.arduino.*;
Arduino arduino; 
int motorPin1 = 2, motorPin2 = 3, motorPin3 = 4, motorPin4 = 5;
int phasecounter = 1, notecounter = 0, flashcounter = 0;
int timer, timer2;
int timelength = 100;
boolean direction, stop, counter1, counter2, flash;

void setup() {
  size(400, 400);
  noStroke();
  arduino = new Arduino(this, Arduino.list()[0], 57600);
  timer = millis();
  arduino.pinMode(motorPin1, arduino.OUTPUT);
  arduino.pinMode(motorPin2, arduino.OUTPUT);
  arduino.pinMode(motorPin3, arduino.OUTPUT);
  arduino.pinMode(motorPin4, arduino.OUTPUT);
  counter1=true;
  counter2=false;
}


void draw() {
  println(timer);

//////////////////////CODE 1 I tried//////////////////////////
  while(counter1==true){
    movemotor();
    timer=millis();
    println("timer" +timer);
        if (timer>=6000) {
        counter1=false;
         counter2=true;}
  }
while(counter2==true){
   timer2=millis();
   stop=true;
    println("timer2 " +timer2); 
          if (timer2>=6000) {
           counter1=true;
         counter2=false; }
 }
      
 }
void movemotor() {
  if (stop == false) { // if the motor is not stopped
    if (millis() - timer >= timelength) {
      timer = millis();
      if (direction == true) {
        phasecounter ++;
      }
      else {
        phasecounter --; // makes the motor go the other way if direction is false
      }
    }
    if (phasecounter > 4) {
      phasecounter = 1;
    }
    if (phasecounter < 1) {
      phasecounter = 4;
    }


    switch(phasecounter) {
    case 1: 
      arduino.digitalWrite(motorPin1, arduino.HIGH);
      arduino.digitalWrite(motorPin2, arduino.HIGH);
      arduino.digitalWrite(motorPin3, arduino.LOW);
      arduino.digitalWrite(motorPin4, arduino.LOW);
      break;
    case 2: 
      arduino.digitalWrite(motorPin1, arduino.LOW);
      arduino.digitalWrite(motorPin2, arduino.HIGH);
      arduino.digitalWrite(motorPin3, arduino.HIGH);
      arduino.digitalWrite(motorPin4, arduino.LOW);
      break;
    case 3: 
      arduino.digitalWrite(motorPin1, arduino.LOW);
      arduino.digitalWrite(motorPin2, arduino.LOW);
      arduino.digitalWrite(motorPin3, arduino.HIGH);
      arduino.digitalWrite(motorPin4, arduino.HIGH);
      break;
    case 4: 
      arduino.digitalWrite(motorPin1, arduino.HIGH);
      arduino.digitalWrite(motorPin2, arduino.LOW);
      arduino.digitalWrite(motorPin3, arduino.LOW);
      arduino.digitalWrite(motorPin4, arduino.HIGH);
      break;
    }
  }
  else { // releases all power from motor (lets it cool); 
    arduino.digitalWrite(motorPin1, arduino.LOW);
    arduino.digitalWrite(motorPin2, arduino.LOW);
    arduino.digitalWrite(motorPin3, arduino.LOW);
    arduino.digitalWrite(motorPin4, arduino.LOW);
  }
}

6 seconds after that code starts running, the values returned by millis() will be greater than 6000.

It isn't clear why variables named countern are assigned true or false. Count in the name implies that you are counting things. True and false hardly ever get used when counting. One, two, three, false, five...? No... Just doesn't work for me.

There are no comments to explain what you think the code should be doing, so it is hard to tell if the code is doing what you expect it to.

I am trying to make the relay motor stop and start.

This code looks like it is driving a stepper motor. And, not well at that.

You need to start with a description of the hardware. If the Arduino is wearing a motor controller shield, motorpin1 through motorpin4 are lousy names. dirLeft, dirRight, enableLeft, and enableRight would be better names.