# gpio

Configure a `gpio` input controller to use a GPIO- or ADC-based device to communicate with your machine.

To be able to test your controller as you configure it, physically connect your controller to your machine’s computer and turn both on.

- [Attributes example](https://docs.viam.com/reference/components/input-controller/gpio/#configure-a-gpio-input-controller-0)
- [JSON Template](https://docs.viam.com/reference/components/input-controller/gpio/#configure-a-gpio-input-controller-1)
- [JSON Example](https://docs.viam.com/reference/components/input-controller/gpio/#configure-a-gpio-input-controller-2)

The following attributes are available for `gpio` input controllers:

| Name | Type | Required? | Description |
| --- | --- | --- | --- |
| `board` | string | **Required** | The name of the board component with GPIO or ADC pins to use as the controlling device. |
| `buttons` | object | **Required** | The [Buttons](https://docs.viam.com/reference/apis/components/input-controller/#button-controls) available for control. These should be connected to the GPIO/ADC board.<br>**Each button has the following fields:**<br>- `name`: Name of the Digital Interrupt the button/switch is connected to, as configured on the board component.<br>- `control`: The [Control](https://docs.viam.com/reference/apis/components/input-controller/#control-field) type to use when reporting events as this button’s state is changed.<br>- `invert`: Boolean indicating if the digital input (high/low) should be inverted when reporting button Control value indicating button state.<br>  <br>  This option is given because digital switches vary between high, `1`, and low, `0`, as their default at rest.<br>  - _true:_`0` is pressed, and `1` is released.<br>  - _false (default):_`0` is released, and `1` is pressed.<br>- `debounce_ms`: How many milliseconds to wait for the interrupt to settle. This is needed because some switches can be electrically noisy. |
| `axes` | object | **Required** | The [Axes](https://docs.viam.com/reference/apis/components/input-controller/#axis-controls) available for control. These should be connected to the GPIO/ADC board.<br>**Each axis has the following fields:** <br>- `name`: Name of the Analog Reader that reports ADC values for the axis Control, as configured on the board component.<br>- `control`: The [Control](https://docs.viam.com/reference/apis/components/input-controller/#control-field) type to use when reporting events as this axis’s position is changed.<br>- `min`: The minimum ADC value that the analog reader can report as this axis’s position changes.<br>- `max`: The maximum ADC value that the analog reader can report as this axis’s position changes.<br>- `deadzone`: The absolute ADC value change from the neutral `0` point to still consider as a neutral position. This option is given so tiny wiggles on loose controls don’t result in events being reported.<br>- `min_change`: The minimum absolute ADC value change from the previous ADC value reading that can occur before reporting a new [`PositionChangeAbs Event`](https://docs.viam.com/reference/apis/components/input-controller/#event-object). This option is given so tiny wiggles on loose controls don’t result in events being reported.<br>- `bidirectional`: Boolean indicating if the axis changes position in 1 direction, like on an analog trigger or pedal, or 2, like on an analog control stick.<br>  - _true:_ The axis should report center, `0`, as halfway between the min/max ADC values.<br>  - _false:_`0` is still the neutral point of the axis, but only positive change values can be reported.<br>- `poll_hz`: How many times per second to check for a new ADC reading that can generate an event.<br>- `invert`: Boolean indicating if the direction of the axis should be flipped when translating ADC value readings to the axis Control value indicating position change.<br>  - _true:_ flips the direction of the axis so that the minimum ADC value is reported as the maximum axis Control value.<br>  - _false:_ keeps the direction of the axis the same, so that the minimum ADC value is reported as the minimum axis Control value. |

## Test the input controller

After you configure your input controller, open the input controller’s **TEST** panel on the **CONFIGURE** or [**CONTROL**](https://docs.viam.com/monitor/default-interface/#web-ui) tabs.
View the current value of each input on your controller.
