Skip to content

User Input

Use the User Input blocks to use user entered data in a Blockly program.

Note

This feature is not supported for code that is uploaded to a //control.Node. The code must be run from Capstone.

Create a list from a table display

Instead of creating a List of values using a block from the Lists category, you can create a list by entering values in a table display. Using a table is convenient since you don't need to modify code to add or remove items from a list. Consider the following example:

In this example, the program sets the speaker to output each frequency in the list block for 500 ms. You can accomplish the same thing by using the create list block in the User Input category:

Instead of entering the values in a list block, you enter the values in a table display:

To create a user-entered data table:

  1. Create a new experiment page and add a Table.
  2. In one of the columns, click <Select Measurement>, then select Create New > User-Entered Data.
  3. Enter a name for the data.
  4. Enter data in the column.

Once you have created a user-entered data measurement, you can then add a create list block to the Blockly workspace.

Get last value of a user-entered list

The last value of block allows you to return the last value of a user-entered list as a text string. The block can be inserted into any other block that accepts a text value. This block features two dropdown boxes, as shown below. The box on the left allows you to select a user-entered measurement in the current Capstone file. The box on the right allows you to select a set of data for that measurement.

Note

Because the output of last value of is considered a text string, it cannot be used for any function that requires a numerical value, even if the contents are a number.