 
   if (homeing) {
     enable();
-    if (digitalRead(2)) {
-
-      stepperX.move(-10000);
-
+    if (!digitalRead(2)) { // Allready at home position
+      stepperX.move(1000); // Move away from home
+      }
+    if (digitalRead(2)) {  // If not homed
+      stepperX.move(-1000);// Move towards home
     }
   }
-
 }
 
 void enable() {

  stepperY.run();
  stepperX.run();
}
void setY() {
  stepperX.stop();
  stepperX.setCurrentPosition(0);
  homeing = false;
}
void loop()

{
  Serial.begin(57600);
  Serial.setTimeout(25);
  stepperX.setMaxSpeed(3000);
  stepperX.setAcceleration(4000);


  stepperY.setMaxSpeed(1000);
  stepperY.setAcceleration(4000);


  Timer1.initialize(86);              // Microseconds
  Timer1.attachInterrupt( timerIsr );  // Attach stepper update function
  pinMode(2, INPUT_PULLUP);            // Enable pullup resistors for the homing switch
  attachInterrupt(0, homeXIsr, FALLING);   // Attach homing function
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);

