I'm using this small joystick: http://www.amazon.com/Thumb-Joystick-Module-Arduino-Black/dp/B00CP0TMU2/ref=sr_1_1?ie=UTF8&qid=1448263500&sr=8-1&keywords=arduino+joysticks
I'm starting out just trying to move the stick and read the values in the serial window...so the code is pretty simple right now.
The serial window displays 1023x1023 all the time! It never changes even when I move the joystick around.
What am I forgetting to do?
Thanks...
const int joystickYpin = 14; // analog A0
const int joystickXpin = 15; // analog A1
int mouseX = 0;
int mouseY = 0;
void setup()
{
Serial.begin(9600);
pinMode(joystickYpin, INPUT);
pinMode(joystickXpin, INPUT);
}
void loop()
{
mouseX = analogRead(joystickXpin); // will be 0-1023
mouseY = analogRead(joystickYpin); // will be 0-1023
Serial.print(mouseX);
Serial.print("x");
Serial.println(mouseY);
delay(250);
}