Skip to content

Code tool

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

To access the Code tool, click Code in the main toolbar at the top of the screen.

  1. Code execution switch

    Toggle to disable code 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 add a block to the workspace to build 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 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 the block to access the block tools menu. If using a mobile device, tap and hold the block. 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 to 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

      This 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.

  9. Record button

    Click to begin recording data. When no sensors are connected, this button changes to Execute , which causes the code to begin running.