 
 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 turnMotor(bool state, bool direction){
  if(state){
    digitalWrite(MOTOR_SLEEP_PIN, HIGH);
    if(direction){
      digitalWrite(MOTOR_PIN1, HIGH);
      digitalWrite(MOTOR_PIN2, LOW);     
    } else {
      digitalWrite(MOTOR_PIN1, LOW);
      digitalWrite(MOTOR_PIN2, HIGH); 
    }
    
  } else {
    digitalWrite(MOTOR_PIN1, LOW);
    digitalWrite(MOTOR_PIN2, LOW);  
    digitalWrite(MOTOR_SLEEP_PIN, LOW);
  }

}



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