FRC LabVIEW Tutorials - Using an Enum for the autonomous multi-select


With the default code, there is a Dashboard Write in begin that takes an array of strings and sends them to the dashboard (it’s used there to populate an “auto selector” dropdown):

default strings sent to dashboard

This is then read back in the beginning of the provided auto-code template for a case structure.

default strings read from dashboard into case structure

These strings are case-sensitive, space-conscience strings - requiring you to type the exact same value into the string array in Begin and into the case structure in Auto. Yuck.

Let’s use an enum

For the sake of simplicity, let’s use an enum to provide the strings to the dashboard and to populate our case structure (an enum is a coding construct where names are given to numeric values - here, we’re using the names and taking advantage of the defined ordering).

In, create an enum control (we need to access the strings from the enum via properties, which are not available on a constant).

Create an enum in

Change it to an enum control

Right click on the control, and select: Create -> Property Node -> Strings[]

Create an enum in

Then, connect the strings array to the dashboard.

Use the enum strings to populate the dashboard

We may want to update the values later (either adding, or substituting), so let’s take a moment to make this enum a TypeDef (docs here)

Back in Auto

The value coming back from the dashboard is still a string, but we can convert it to the enum.

Place a copy of the typedef’d enum on the diagram connected to a “Scan from String” as the default value.

Use the enum as the default value into the ScanFromString

The “Scan from String” will identify the value of the enum that matches the passed string (while one can do this with arbitrary strings, it is best to do it only when the strings are guaranteed to be equivalent to one of the enum value names).

Connect the output from the “Scan from String” to a new case structure.

Connect to a new case structure

Open the typedef and provide the desired possible modes (make sure to include a do-nothing).

Set the typedef to the desired values

Apply changes:

Apply the changes

(save and close the TypeDef)

Right click on the case structure and select “Add case for every value” this will create a case (branch) for each option in the enum.

Change it to an enum control

(For an example of later updating the typedef enum with different or more values, see the TypeDef Tutorial)


You now have an enum that (if edited) will update both in - where it’s strings are sent to the dashboard to select an auto, and in Autonomous(…).vi - where it is used to parse the returned string and manage possible case structure values.

Possible Improvements


Table of Contents