This joystick contains two variable resistors (VR).
One for the X axis (Left and Right)
One for the Y axis (Up and Down)
It also has a Button SWitch that you can click by pressing down on the stick.
The switch is active low (meaning it is backward) low=clicked.
To use the joystick you often have to scale and shift the values to match the device you are controlling
For example if you want to move side to side on the mBlock screen you need to do this math:
Joystick 0 to 1023 (1024 positions)
X Screen -240 to 240 (480 pixels)
1024 / ScaleFactor = 480
ScaleFactor = 1024/480 =
2.13
We must then shift left from 0 to -240
ShiftAmount=-240
Thus our final equation with Scale and Shift:
(JoystickX/2.13) - 240
You can control a number of Blocks using the Joystick:
WiggleBlock, RainbowBlock, GoBlock, JiminyBot