One wire, five directions
Four tilts and a press, and one wire to your board. The TK94's switch joins SIGNAL to a different point of a chain of resistors for each push, so every push is its own voltage and one analog pin tells all five apart. It is not five digital switches, whatever the page before this one said.
Five pushes, five voltages
The cap sits on a five-way navigation switch: tilt it up, down, left or right, or press it straight down. Each of the five closes its own contact, and every contact runs from the same pin, SIGNAL, to a different point of a chain of five 10 kΩ resistors between VCC and GND.
So each push gives SIGNAL its own voltage. With VCC at 3.3 V:
| Push | SIGNAL | Of VCC |
|---|---|---|
| Nothing | 0 V | 0 |
| Up | 0.37 V | a ninth |
| Press | 0.60 V | two elevenths |
| Left | 0.90 V | three elevenths |
| Down | 1.47 V | four ninths |
| Right | 3.30 V | all of it |
One analog pin reads which: one pin of your board does the work of five digital ones.
Held the way its words read
The names in this book are for the block held with its header on the left. That is the way "lonely binary" and "ANALOG" on its front read across, and the way the maker's own sketch named the pushes. Mounted another way, the voltages stay with the contacts and the names turn with the block.
What the page before this said
The page this handbook replaces called the TK94 "five separate momentary switches", read with "a plain digitalRead" on "five digital lines", with pull-ups fitted. There is one output, no pull-up, and a digital read sees right as HIGH and the other four as LOW. Further down it said the reading rests near 512; it rests at 0.
The trade is the one the old page described for the wrong board. There is no centre to calibrate and no dead zone, because the steps are the switch's own, but there is no in-between either: a push is on or off. For a stick that reports how far it is tilted, see the TK23 or the TK21.
When it does not work
That is what a digital pin makes of it. Up, the press, left and down are all under a volt or two, which a digital input calls LOW; only right, which is all of VCC, reads HIGH. SIGNAL goes to an analog pin and is read with analogRead.
No, 0 is the resting reading. A thumb stick rests in the middle of its range, but this block does not: with nothing pressed, a 10 kΩ resistor holds SIGNAL at GND. Push any way and the number jumps to that push's level.
Hold the block with the header on the left, so the words on its front read across. That way up is a ninth of VCC and right is all of it, which is also how the maker's own sketch named them. Turn the block and every name turns with it.
The switch, six resistors and a capacitor, and what each one does.
What is on it →Edit this page — content/books/five-direction-joystick/one-wire-five-directions.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.