Skip to content

Code tool

The Code Tool interface consists of a workspace to build a program using blocks from the Blockly Toolbox.

To access the Code tool, click Code on the bottom of the Experiment Screen.

  1. Code execution switch

    Toggle to disable the Code tool from running a program during data collection. This can be useful when you want to test sensor measurements without having the code interrupt data collection.

  2. Blockly Toolbox

    Click a category to view blocks that can be added to the workspace when building a program.

  3. Lua code viewer

    Click the Lua tab to view, but not edit, what the program looks like in text-based code to help with debugging.

  4. //control.Node upload tools

    Upload code to the //control.Node so that it can run independently from a computing device. This toolbar only appears when a //control.Node (PS-3232) is connected.

  5. Code Tools

  6. Workspace Tools

    • Center the code on the workspace.
    • Zoom in on the workspace.
    • Zoom out of the workspace.
    • Delete blocks by dragging them to the trash can. Click the trash can to retrieve previously deleted blocks.
  7. Block tools

    Right-click a block to access the block tools menu. (If using a mobile device, tap and hold the block instead.) What appears in the menu depends on the block. The following tools are common to most blocks:

    • Duplicate

      This creates a copy of the block.

    • Add Comment

      This adds a comment icon to the block. Click the icon to add a note to the block, which can help others understand what your code does.

    • External and Inline Inputs

      This option appears for blocks that have more than one input. Selecting External Inputs will make input blocks appear as a vertical list outside of the block. Selecting Inline Inputs will make input blocks appear inside the block as a horizontal list.

    • Collapse and Expand Block

      Collapse block collapses all the code inside the block into a single line. This can be useful for de-cluttering the workspace to make the code easier to read. Select Expand Block to display the code again.

    • Disable Block

      This disables the block and the code inside the block. This can be useful for debugging a program.

    • Delete Block

      This deletes the block and all code inside the block.

  8. Workspace

    Drag blocks from the toolbox to the workspace to create a program.