When a reading is wrong
Two lights do half the diagnosis before any sketch runs: PWR says the board has power, SW says the switch closed. Six symptoms cover nearly everything: PWR dark, X and Y stuck, SW never HIGH, SW always HIGH, a stick that creeps, and one click counted as several.
Look at the lights first
Before opening the serial monitor, look at the board. The red PWR light should be on. Press the stick straight down and the blue SW light should come on with the click, dimly on a 3.3 V board. Those two answers split every fault into the board's side and your side, and they need no sketch.
Pick what the block is doing. The figure draws the lights as you should see them in that case, rings the part to look at, and lists the checks in the order they usually find it.
The four that are wires
PWR dark. VCC or GND is missing, or the two are swapped. Count from the square pad: GND is the left-hand end with the header at the bottom.
X and Y stuck near 0 or at the top, with PWR lit. They are not on the pins the sketch reads, or one of them landed on NC, the third hole, which goes nowhere.
SW never HIGH. If the SW light comes on when you press, the board is fine and SW is on another pin than the sketch's, or the sketch tests for LOW. If the light stays dark, press straight down harder: the click takes more force than the tilt.
SW always HIGH with the SW light dark. The switch is open, so R10 is holding SW LOW; a pin reading HIGH is not on SW, or floating, or has a pull-up switched on.
The two that are the stick
Creeps when let go. The centre was assumed, or measured while the stick was held over. A centre and a dead zone measures it at start-up; let go and press reset.
One click, several. The contacts bounce. A click that counts once counts the change and then waits 20 ms.
And one that is VCC
If a 3.3 V board was ever run with VCC on 5V, every click put 5 V on a pin rated for 3.3 V. If that pin now reads oddly with the wiring right, move SW to another pin and VCC to 3V3, and read VCC sets the top.
When it does not work
The pin numbers changed, and maybe VCC should have too. Every sketch in this book lists all four boards' pins in one comment line, in the order X, Y, SW: Uno A0 A1 2, ESP32 34 35 25, ESP32-S3 4 5 7, Pico 26 27 15. VCC goes to 5V on the Uno and 3V3 on the others.
A long cable or a motor on the same supply adds noise, and near the centre the readings are small numbers. Keep the cable short, give the motors their own supply, and make the dead zone a little larger.
On an ESP32, check X and Y are on ADC1 pins, as they are in this book: GPIO 34 and 35. ADC2 stops answering while Wi-Fi is on. On an ESP32-S3, GPIO 4 and 5 are ADC1 too.
The pins, the wiring and the specifications on one page, for when you only need to look something up.
The Dual Axis Joystick reference page →Edit this page — content/books/dual-axis-joystick/when-a-reading-is-wrong.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Dual Axis Joystick
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.