Joystick analog reading values sometimes changed

Hello,
I am New to Embed System working on Arduino Mega Board. 2 Days before I was working with the Joy Stick Sensor and Wrote some Program for the project. Today, I got another values from the joystick sensor. I unable to run the program. due to some other values read by board anyone help me to solve this?

Welcome to the forum.
Take a few minutes and read How to get the best out of this forum tutorial.
It help you to wrote correct messages to the thread.

Please be more specific.
What are "another values"? How do you see it if your program doesn't work?
Please show your code and draw your schematic.

Thanks for your reply. I go through link which you provided,

2 days before my sensor readings

//Simple Reading Program
x=504; y=487; button=1;
//output "No Movement"

Today Readings

//Simple Reading Program
x=517; y=518; button=1;
//output Nothing

Are this a significant difference?
If you need help - please show your code in full.

my code

int joyStickvrx=A0;
int joyStickvry=A1;
int joyStickbtn=2;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(joyStickvrx,INPUT);
pinMode(joyStickvry,INPUT);
pinMode(joyStickbtn,INPUT_PULLUP);
}

void loop() {
  // put your main code here, to run repeatedly:
Serial.print(analogRead(joyStickvrx));
Serial.print("  ");
Serial.print(analogRead(joyStickvry));
Serial.print("  ");
Serial.println(digitalRead(joyStickbtn));
}

This code does not match the output in message #3

What is your question?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.