Xtreme STEM
DashX

RoboBloX

JoyBlock

JoyBlock

 

Theory

Variable Resistor

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.

 

Connection Diagram

JoyStick

 

mBlock

joy

 

Example Programs

joy

joy

 

 

Advanced

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

joy

 

You can control a number of Blocks using the Joystick:

WiggleBlock, RainbowBlock, GoBlock, JiminyBot

 

Project Ideas

  1. Video Game
  2. Color wheel
  3. Drive robot
  4. Wiggle mirrors

 

Scroll to Top