SunFounder ESP32 Starter Kit
4.23.2 Build the Circuit
A joystick is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it
is controlling. Joysticks are often used to control video games and robots.
In order to communicate a full range of motion to the computer, a joystick needs to measure the stick’s position on two
axes - the X-axis (left to right) and the Y-axis (up and down).
The motion coordinates of the joystick are shown in the following figure.
Note:
• The x coordinate is from left to right, the range is 0-1023.
• y coordinate is from top to bottom, range is 0-1023.
Now build the circuit according to the following diagram.
658 Chapter 4. Play with Scratch