Knowledge Base

Gamepad (Sticks) Block

It's time to get back in control... with the gamepad blocks.

The Gamepad (Sticks) block allows you to control the motors and servos of your robot with the gamepad. This block enables this type of function by providing the motor or servo blocks with values from the actual input from the pad. All blocks from the Gamepad section of the Block Library must be placed inside a Repeat While True loop so that the commands repeat indefinitely. 

The Gamepad (sticks) block returns a value based on the x-axis (left/right) or y-axis (up/down) position of either the left or right gamepad joystick. This value can be assigned to a Single Motor block for example to rotate the motor based on in which direction and the extent to which the stick is pushed.


The default value (not pushed in any direction) of a joystick is 0. The values can range from -1 to 1, depending on how far the stick is pushed in each direction. Because of the base range of the values, the values must be multiplied by 100 using a numerical operator block in order to extend the range to -100 to 100, which is the base range of the motor blocks.  

To apply the gamepad (sticks) block to a program:

  1. Add a motor or servo block into a Repeat While True loop.
  2. Add a Numerical Operator block to one of the parameters (or the single parameter) of the motor block.  
  3. Add the Gamepad (Sticks) block to the first slot of the numerical operator. 
  4. Using the numerical operator, multiply the value of the gamepad (sticks) block by 100. 
  5. Use the central and right drop-down menus to select the assignment for one of the sticks in either the x or y direction, respectively. Use the left drop-down menu to select the gamepad being used, if necessary. 

Example Program

When this program executes, the up/down movement of the left stick controls the left motor, and the up/down movement of the right stick controls the right motor. 


Parameter Configuration
Get gamepad

Select the desired gamepad.


Select the desired stick (left/right).

Axis Select the desired axis (x/y).


Was this article helpful?
0 out of 1 found this helpful


Please sign in to leave a comment.

Powered by Zendesk