Block Categories Overview
Blocks is designed to hide the excess options that are not actively in use based on the configuration. This makes it easier to navigate, but there remains some mystery behind what and where everything is.
Well we can't go into every block available, let's take a look at the different categories and some use cases for the blocks within them.
Changing Based on Configuration
Before going too far, recall that the active configuration on the Control Hub will effect which blocks are available for certain categories.

For example, having a servo configured for angular mode will show blocks for setting positions, while having a servo configured for continuous rotation will show options for setting power.
Some categories, like Other Devices or Java Classes, will no longer be clickable or completely hidden depending on your set up.

Categories
LinearOpMode
The LinearOpMode category list various call blocks for the OpMode, such as the check for if it is active and to wait for the Driver Hub's play button to be pressed. The call to sleep can also be found here.

Gamepad
The gamepad menu is where all the blocks related to gamepad inputs can be found. The gamepad blocks are grouped based on if they are a float or Boolean input.

Actuators
The Actuators menu options will change based on the active configuration file. Some default blocks will always be available, such as some PWM options under ServoController.
When a motor is added to a configuration, the blocks to set its power, mode, direction, and more will become available. For servos, those configured for angular mode will show blocks for setting positions while those set to continous rotation will show power and direction.

Sensors
What sensors are available will change based on the active configuration file. Once a sensor is added, different options will appear based on the sensor. Some will have two menu options for more generic sensor use or for a specific manufacturer.


Other Devices
Analog Sensors, if configured, will appear under Other Devices. Other device's controls, like the Blinkin LED Driver, will also be available here if configured. If no relevant devices are configured, this menu will not be accessible.

Utilities
The Utilities category is a mix of tools built-in to the SDK to pair with different blocks while building out the full OpMode. For example, when using a color sensor blocks related to Color, such as finding the Hue, can be found under Utilities to define how the sensor is being used and what kind of data is being collected.
Additionally, here you will find the Telemetry menu to send information to the Driver Hub.


Logic
The Logic Category is the first set of categories that make up the colorful section of Blocks for the bottom half of the list. In this menu we'll find the options for making if/else statements, setting something to "not", and blocks for creating comparison statements, like checking if something is greater than something else.

Loops
The green Loops category includes the list for blocks to create repeats within the program. Loops can have different exit conditions, such as only repeating a set number of times or until Stop is pressed on the Driver Hub.

Math
Under the Math category there is blocks to make something negative, to add a number to a program, and several options for completing different calculations in the program.

Text
Similar to Math, the Text category allows the addition of text entries to a code that the robot will read for executing, unlike Comments, as well as formatting options and ways to change the text based on a situation.

Lists
The blocks found in the Lists category can be used to compile data into one list as it is collected by the robot.

Variables
The Variables category will initially show as blank until a new variable is created, then the options for setting and using the variable will appear. If a variable goes unused when the program is saved and closed, it will be removed upon reopening the OpMode.

Functions
The Function blocks allow for code to be separated into smaller chunks making Blocks a little easier to organize and read. Once a new function is created and named, additional blocks will become available to call the function.

Miscellaneous
The Miscellaneous category includes blocks to assist with formatting in the code and to add comments. Comments allow a programmer to make notes without the robot reading them!

Last updated
Was this helpful?

