I have a joystick in my circuit and it has been returning a wave pattern even though all of the pins on the joystick are connected to my Arduino.
The waves look like this in the serial plotter (with interpolate on):
My guess is that your wiring is picking up noise at your mains frequency, and that you are not taking analogue reading at a high enough rate to see that it is a 50Hz/60Hz sinewave.
This is known as aliasing.
It looks to me as though you have a signal of oround 0.5V with approvimately 50mV of mains hum superimposed on it.
Using a function generator to give a 50Hz, 50mV signal, I can create a similar waveform to yours by taking a sample every 10.5ms. (just over half the period of the input signal).
What waveform do you get when you use the jotstick?
An image of your joystick would be good as well as a link to specs/data?
If it is the switching type joystick, rather than the pot type, with the joystick in the middle the inputs to the UNO will be open circuit.
Please get your pen(cil) and paper out and post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
I thought that the 5V had to be the opposite side of the one that is being given to the Arduino and the GND is parallel to the wire that goes to the Arduino.
From what you've drawn on my diagram the wire that goes to the Arduino connects to the 5V with a resister.
void setup() {
Serial.begin(115200);
Serial.println(("A0\tA1"));
}
void loop() {
analogRead(A0); Serial.print(analogRead(A0)); // double reading to let the voltage stabilize
Serial.write('\t');
analogRead(A1); Serial.println(analogRead(A1));// double reading to let the voltage stabilize
}
open the Serial plotter at 115200 bauds and play with the joystick
if you have the kind of long breadboard double check the rails (red and black lines along the sides) are continuous and not stop somewhere in the middle
So you want me to have the black probe on the Arduino GND and red one on the A2, A3, A4?
I thought because the ground and signal is on the same side that when you press the button it will give the HIGH from the 5V on the other side (Like in the image), is this not how it happens?