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

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. Build a new page and select a Table for the display.
  2. Click Select Measurement.
  3. Select the User-entered tab, then click Create Data Set.
  4. Enter a Measurement Name, then click OK.
  5. 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 and select the name for the measurement you created from the dropdown list in the block.

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 SPARKvue file. The box on the right allows you to select a run 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.