 
 unsigned long alarmLastStarted;
 
+typedef enum{M_CLOCKWISE, M_PAUSE1, M_ANTI_CLOCKWISE, M_PAUSE2} MOTOR_STATE;
+MOTOR_STATE lastMotorState;
+
 unsigned long lastVibration;
-boolean lastMotorDirection;
 
 unsigned long timeLastPressedLeftButton;
 unsigned long timeLastPressedMiddleButton;


void stopAlarm(){
  currentState = NORMAL;
  turnMotor(false, false);
  noTone(SPEAKER_PIN);
  toneNow = 0;
  

  }
}

void motorDriverState(boolean state){
  if(state){
    digitalWrite(MOTOR_SLEEP_PIN, HIGH);
  } else {
    digitalWrite(MOTOR_SLEEP_PIN, LOW);
  }
}

void changeMotorState(boolean active, bool direction){

  if(!active){
     digitalWrite(MOTOR_PIN1, LOW);
     digitalWrite(MOTOR_PIN2, LOW);
     return; 
  }
  
   if(direction){
     digitalWrite(MOTOR_PIN1, HIGH);
     digitalWrite(MOTOR_PIN2, LOW);     
   } else {
     digitalWrite(MOTOR_PIN1, LOW);
     digitalWrite(MOTOR_PIN2, HIGH); 
   }
    


}

