Hat#

The Switch Hat block is used to run the attached stack of blocks when the function is called.

They are shaped to attach above other stack blocks.

hat_block

The attached stack of blocks are a function. The Switch Hat block is used to define the name of the function and any optional parameters.

To define the function, select the open space of the block indicated in the image here and begin typing.

hat_select

Parameters should be enclosed in parentheses and followed by a colon as shown below. If a function has no parameters, use closed parentheses: ().

hat_parameters

In order for a Switch Hat block to function as intended, the Switch Python commands must be entered with the correct spelling, punctuation, and indentation. Refer to the Help of each block to see the matching Switch Python command.

In this example, the Drivetrain will move forward for 400 Millimeters when the drive_400() function is called.

hat_example