
/*
  EasyJoystick - isUp example

  Demonstrates how to read the joystick’s current position using the
  basic state functions (isUp, isDown, isLeft, isRight, isMiddle).

  This example continuously prints the joystick’s current direction
  to the Serial Monitor.
  
  Wiring:
    VRx -> A1
    VRy -> A2
    VCC -> 5V
    GND -> GND
	
  Note:
    joystick.begin(xPin, yPin, flipX, flipY)
    - xPin, yPin must be analog pins
    - flipX/flipY invert directions if needed

*/

#include <EasyJoystick.h>

EasyJoystick joystick;

void setup() {
  joystick.begin(A1, A2, true, true);
  Serial.begin(115200);
}

void loop() {
  joystick.loop();
  if (joystick.isMiddle()) {
    Serial.println("middle");
  } else if (joystick.isUp()) {
    Serial.println("up");
  } else if (joystick.isDown()) {
    Serial.println("down");
  } else if (joystick.isLeft()) {
    Serial.println("left");
  } else if (joystick.isRight()) {
    Serial.println("right");
  }
}
