int m =0;
int n =0;
int p =50;
void setup() {
#define X_pin A1
#define Y_pin A0
#define SW_pin A2
int Yled =4;
int Gled =5;
int Bled =6;
int Rled =7;
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(X_pin , INPUT);
pinMode(Y_pin , INPUT);
pinMode(SW_pin , INPUT);
pinMode(Yled , INPUT);
digitalWrite(Yled, LOW);
digitalWrite(Gled, LOW);
digitalWrite(Bled, LOW);
digitalWrite(Rled, LOW);
Serial.begin(9600);
m = analogRead(X_pin);
n = analogRead(Y_pin);
}
void loop() {
Serial.print("\n");
Serial.print("Xpin");
Serial.print(analogRead(X_pin));
Serial.print("\n");
Serial.print("Ypin");
Serial.print(analogRead(Y_pin));
Serial.print("\n");
Serial.print("SWpin");
Serial.print(analogRead(SW_pin));
Serial.print("\n");
delay(100);
if (Y_pin < n - p )
{digitalWrite(4, HIGH);}
else
{digitalWrite(4, LOW);}
}