Rotary Switch

The rotary switch, or rotary selector switch, is used to select one of several options.  The switches are usually mechanical so pull-up resistors and debouncing needs to be used.  See Mechanical Switches for more information.

As shown in the schematic above, each output of a rotary switch needs its own pin.  If the rotary switch has many outputs, consider using a Coded Rotary Switch.

The rotary switch will appear on the HID device as an input with values that range from 0 to outputs - 1.

Properties

Name

Components can be given an optional name.  This is seen in the Test tab. Not all applications support the name.  Hidcomp/hidconfig supports names.

UsagePage/Usage

The UsagePage and Usage of the Rotary Switch. See Usages for more information.

Outputs

The number of outputs on the selector switch.  Note that the display of the rotary switch isn't updated when the number of outputs is changed.  There is also a limit of 12 outputs.  If you need more than 12 outputs, you'll need to define the device via an .mcd file

Pull-up

Selecting this enables the internal pull-up resistor of the microcontroller. This is the normally setting. See Mechanical Switches for more information.

Debounce (ms)

Waits for the mechanical switch stop bouncing before registering a switch closure.  Enter the time to wait in milliseconds. See Mechanical Switches for more information.

Current

Defines the amount of electrical current used by the rotary switch in mA. This is used to estimate the USB power draw.  See the section on Power for more information.

Current drawn by switches is usually insignificant and can be set to 0.