Blockly

ARC introduces Blockly Programming for beginners. We recommend that early beginners start with RoboScratch before Blockly. Once you have become comfortable with RoboScratch, moving to Blockly is the next step on your programming adventure!




Copy Blocks

You can copy a group of blocks by selecting the outer scope block. An outer scope block is a block that surrounds other blocks, such as an IF condition, REPEAT loop, or FUNCTION. Right-click on the outer surrounding block and select DUPLICATE.


Variables

Blockly has two types of variables: local/private variables and global variables. A global variable will have a dollar sign($) in front of the variable name (i.e. $MyVariable), and a local/private variable does not have a dollar sign($) (i.e. myVariable).

In this example, we first assign a local/private variable followed by a global variable. Notice how the generated syntax differs. The global variable has a ($) dollar sign and sets the variable using the setVar() command. The setVar() command will set the variable into the global storage area.


Global vs Private Variable

A private variable is only available within the script. No other ARC scripts can access a private variable because it only exists within the script's scope. This is useful if your program creates many variables that are not needed by any other scripts.

A global variable is available to any script within the entire ARC project. This means that any other script can read or change the variable contents. This is useful when sharing data across other scripts, such as the robot's state.


How To Use

Step 1

Before using Blockly, load your robot project into ARC. Like RoboScratch, ARC requires an existing project to be loaded and connected to the robot. This gives Blockly commands and actions to start programming with.


Step 2

Load the Blockly Interface. The Blockly UI can be found in two places.

a) The Blockly tab when editing scripts for robot skills.



b) The top File Menu next to RoboScratch and the Virtual Desktops.

Capture.PNG


Step 3

Begin building a program! Using block programming makes programming more accessible in comparison to Syntax Style Programming. You never worry about spelling mistakes or incorrect syntax in a block programming environment. Block programming focuses on learning the logic of Loops, IF conditions, and Variables.

Robot Block Programming Example