/*
 Thumb Joystick demo v1.0
 connect the module to A4&A5 for using;
*/
int xValue = 0;
int yValue = 0;


 void setup() {
 Serial.begin(9600);
}

void loop() {
 xValue = analogRead(A5);
 yValue = analogRead(A4);
 Serial.print("The X and Y coordinate is:");
 Serial.print(xValue, DEC);
 Serial.print(",");
 Serial.println(yValue, DEC);
 Serial.println(" ");
 if(xValue<300){
  Serial.println("right");
  }
  if(xValue>700){
    Serial.println("left");
    }
 if(yValue<300){
  Serial.println("up");
  }
  if(yValue>700){
    Serial.println("down");
    }
 delay(1000);
}
