帽子#
当调用该函数时,Switch Hat 块用于运行附加的块堆栈。
它们的形状适合附着在其他堆叠块之上。
VEXcode 开关块示例,展示了开关帽块#
[ ] :: hat custom-switch
附加的块堆栈是一个函数。Switch Hat 块用于定义函数的名称和任何可选参数。
要定义功能,请选择此处图像中指示的块的空白处并开始输入。
Parameters should be enclosed in parentheses and followed by a colon as shown below. If a function has no parameters, use closed parentheses: ()
.
VEXcode Switch Blocks 示例展示了一个带有 Python 函数的 Switch Hat 块,该函数有一个参数#
[def function_name(parameter):] :: hat custom-switch
为了使 Switch Hat 模块按预期运行,必须使用正确的拼写、标点符号和缩进输入 Switch Python 命令。请参阅每个模块的帮助以查看相应的 Switch Python 命令。
In this example, the Drivetrain will move forward for 400 Millimeters when the drive_400()
function is called.
VEXcode 开关块示例,其中显示了开关帽块和前进驱动块#
[drive_400()] :: hat custom-switch
驱动 [向前 v] (400) [毫米 v] ▶