VCC sets the top
A push to the right joins SIGNAL straight to VCC, so whatever VCC is, your analog pin gets. VCC goes to your board's logic voltage: 5V on an Uno, 3V3 on an ESP32, ESP32-S3 or Pico. The page this replaced let any board use either supply; the wrong one puts 5 V on a 3.3 V pin, or misreads four pushes out of five.
Right is VCC
Right's contact joins SIGNAL to the top of the ladder, which is VCC itself. So while the cap is pushed right, the analog pin gets exactly what VCC is. On an ESP32, an ESP32-S3 or a Pico, pins are rated for 3.3 V: VCC on 5V puts 5 V on one each time you push right.
Pick an ESP32 and 5V in the figure. Right goes over the pin's limit, and the other four are misnamed as well, because the sketch expects 3.3 V at the top.
A fraction of what, exactly
Every level is a fraction of VCC: down is four ninths of it, whatever VCC is. The sketch knows the fractions and needs to know what they are fractions of.
- An Uno and a Pico measure against their own supply. With VCC on that same supply, a reading over 1023 is the fraction directly, and a USB port that gives 4.8 V instead of 5 changes nothing.
- An ESP32 and an ESP32-S3 measure against a reference inside the chip. The sketch asks for millivolts and divides by 3300, so VCC must be the 3V3 pin.
Get it the wrong way round on an Uno, VCC on 3V3, and nothing is damaged but the levels are two thirds of what the sketch expects: down reads as left, left as the press, the press as up, and right as down.
The rule
VCC goes to your board's own logic voltage. It is the same rule as the TK96's, for the same reason: a switch on the block puts VCC on your pin.
When it does not work
Perhaps not, but do not keep doing it. Every push to the right joined a pin rated for 3.3 V to 5 V through nothing but the contact. Move VCC to 3V3, then check the pin still reads: push each way and compare with the numbers in the first-read sketch.
Every level is two thirds of what the sketch expects, because the Uno measures against its own 5 V. Move VCC to 5V. On an Uno that is both safe and right: SIGNAL never goes over the 5 V the pin runs at.
Not on an Uno. With VCC on the Uno's own 5V pin, the ladder and the ADC share one supply, and every level is the same fraction of it. The sketch divides by the ADC's full scale, so the readings do not move.
Where the five voltages come from, and why they are not tidy fifths.
A ladder of resistors →Edit this page — content/books/five-direction-joystick/vcc-sets-the-top.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Five-Direction 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.