 #include <Servo.h>
 
 // Horizontal axis
-#define StepPinY                2
-#define DirectionPinY           3
-#define StepPinX                4
-#define DirectionPinX           5
-#define JoyH_Y                 A1
-#define JoyH_X                 A0
-																																																												#define JoySwitch 2 // Joystick switch connected to interrupt Pin 2 on UNO
-/*
-#define RPMS                104.0
-#define STEPS_PER_REV         200
-#define MICROSTEPS_PER_STEP     8
-#define MICROSECONDS_PER_MICROSTEP   (1000000/(STEPS_PER_REV * MICROSTEPS_PER_STEP)/(RPMS / 60))
-*/
+#define StepPinH_Y                2
+#define DirectionPinH_Y           3
+#define StepPinH_X                4
+#define DirectionPinH_X           5
+#define JoyH_Y                    A1
+#define JoyH_X                    A0
+
+// Vertical axis
+#define StepPinV_Y                6
+#define DirectionPinV_Y           7
+#define JoyV_Y                    A2
+#define JoyV_X                    A3
+#define ServoV                    10
+
 
 Servo dvd_down;
-// Define a stepper and the pins it will use
-
-//int joyY = A1;
-//int y;
-
-//int angle = 0;
 
 
-//int pos = 12600;
+
 /*
 void setup()
 {


void setup() {
	// Big
	pinMode(DirectionPinY, OUTPUT);
	pinMode(StepPinY, OUTPUT);
	digitalWrite(StepPinY, LOW);
	digitalWrite(DirectionPinY, LOW);

	// Scanner
	pinMode(DirectionPinX, OUTPUT);
	pinMode(StepPinX, OUTPUT);
	digitalWrite(StepPinX, LOW);
	digitalWrite(DirectionPinX, LOW);

	Serial.begin(9600);
	Serial.print("Ready");

	//dvd_down.attach(10);
}




	//Serial.println(analogRead(JoyH_X));
	//Serial.println(analogRead(JoyH_Y));
	Serial.println(analogRead(JoyV_Y));
	Serial.println(analogRead(JoyV_X));

	// Big
	if (analogRead(JoyH_Y)<400)
	{
		move_big();
		digitalWrite(DirectionPinH_Y, LOW);
	}

	if (analogRead(JoyH_Y)>600)
	{
		move_big();
		digitalWrite(DirectionPinH_Y, HIGH);
	}
	
	// Scanner
	if (analogRead(JoyH_X)<400)
	{
		move_scanner();
		digitalWrite(DirectionPinH_X, HIGH);
	}

	if (analogRead(JoyH_X)>600)
	{
		move_scanner();
		digitalWrite(DirectionPinH_X, LOW);
	}

	// DVD
	if (analogRead(JoyV_Y)<400)
	{
		move_dvd();
		digitalWrite(DirectionPinV_Y, HIGH);
	}

	if (analogRead(JoyV_Y)>600)
	{
		move_dvd();
		digitalWrite(DirectionPinV_Y, LOW);
	}

	// Servo

	if (analogRead(JoyV_X)<400)
	{
		int y = map(analogRead(JoyV_X), 0, 1023, 900, 2100);
		dvd_down.write(y);
		delay(1000);
	}

	if (analogRead(JoyV_X)>600)
	{
		int y = map(analogRead(JoyV_X), 0, 1023, 900, 2100);
		dvd_down.write(y);
		delay(1000);
	}

}

void move_big() // big motor
{
	digitalWrite(StepPinH_Y, HIGH);
	delayMicroseconds(100); //big motor

	digitalWrite(StepPinH_Y, LOW);
	delayMicroseconds(100); //big motor
}

void move_scanner()
{
	digitalWrite(StepPinH_X, HIGH);
	delayMicroseconds(.01); //scanner

	digitalWrite(StepPinH_X, LOW);
	delayMicroseconds(.01); //scanner
}

void move_dvd()
{
	digitalWrite(StepPinV_Y, HIGH);
	delayMicroseconds(700); //DVD

	digitalWrite(StepPinV_Y, LOW);
	delayMicroseconds(700); //DVD
}

void move_servo()
{
	digitalWrite(StepPinV_Y, HIGH);
	delayMicroseconds(700); //DVD

	digitalWrite(StepPinV_Y, LOW);
	delayMicroseconds(700); //DVD
}