Navigating Blocks
This section pairs with Unit 1, Lesson 6 from the Intro to Robotics V2 curriculum.
Blocks is a visual programming language designed to be new programmer friendly by helping to streamline parts of the process and cut down the risk of common syntax errors. While it appears similar to other visual languages, such as Scratch or Blockly, it is designed specifically for use with the DUO Control System.
Accessing Blocks
While connected to a powered Control Hub via USB, open the REV Hardware Client. Select the Control Hub to be programmed then the Program and Manage menu.

The options for Blocks and OnBot Java should appear at the top alongside the manage option.

Select Blocks. Let's take a look at the landing page below:

Create a new OpMode
Upload an OpMode
Download all saved OpModes
All currently saved OpModes and information
Enable/Disable OpModes
Deleting, Renaming, and Downloading OpModes
While on the home screen, existing OpModes can be modified or downloaded. Downloading a copy of an important OpMode is recommended to help prevent a project being lost in the event of accidental deletion, change, or equipment failure. Blocks DOES NOT autosave.

Select the checkbox beside the OpMode you would like to modify first. Then you can select what you would like to do, such as download, delete, rename, or copy.
Creating a New OpMode
To create a brand new OpMode, select Create New OpMode.

This will open the menu to name the OpMode and select a sample program. For now the sample should remain BasicOpMode as this will give us an easy to work with foundation to get started.

The name of our OpMode should be easily recognizable and give some indication of what it's used for. When working with a class, it may be helpful to include student or group names in the OpMode to aid with grading later.
This first OpMode we will use for a couple activities in this training section so we can name it myFirstOpMode.

Once we click OK, Blocks will fully open.
Navigating Blocks
Let's take a tour of the Blocks user interface.

Save OpMode - Click this button to save an OpMode to the robot. It is important to save the OpMode any time you stop working on a code, so that progress is not lost. Blocks does not have an autosave feature!
TeleOp/Autonomous - This section of blocks allows users to change between the two types of OpMode: teleop and autonomous.
Categorized Blocks - This section of the screen is where the programming blocks are categorized and accessible. For instance, clicking Logic will open access to programming blocks like if/else statements.
Programming Space - This space is where blocks are added to build programs. Blocks not currently in the use may be dragged off to the side to be clicked back in later or deleted.
Greeting Message - This intro information message may appear when creating a new, empty OpMode. Clicking the ? icon will close this message.
OnBot Java Editor
The OnBot Java editor will open as well on the righthand side. Click the checkbox to close this for extra space in the programming area.

In the next section, we'll take a closer look at the different categories of Blocks available. Remember if the correct configuration is not active, some Blocks may be hidden, such as those for motors and sensors.

Navigating Blocks Walkthrough Video
Last updated
Was this helpful?

