Knowledge Base

Gamepad (Buttons) Block

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


The gamepad blocks allow you to control a program, and therefore your robot with the gamepad. The block enables this type of function by returning a Boolean (true/false) value based on whether or not a button is pressed. 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 (Buttons) block must also be used in conjunction with an If statement. The statement returns a True value if the assigned button is pressed. It is desirable that an If/Else block is used. 

The gamepad has 12 different buttons which can either be pressed (true/1) or not pressed (false/0).


The default value (not pressed) of a button is 0 or false. When pressed, the value of that button is 1 or true.  

The following is one example of how to apply the Gamepad (Buttons) block to a program:

  1. Add an If block into a repeat-while-true loop.
  2. Add the Gamepad (Buttons) block to the if statement. 
  3. Use the central and right drop-down menus to assign a button to the gamepad block. Use the left drop-down menu to select the gamepad used, if necessary. 


Example Program

When the program below executes, pressing the B button causes the robot to drive forward for 1 second. 


Parameter Configuration
Get gamepad

Select the desired gamepad.


Select the type of button (dpad, bumper, stick, action).

(refer to the image at the top of the page)

Button Select the desired button.


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


Please sign in to leave a comment.

Powered by Zendesk