Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
added web doc code
Browse files Browse the repository at this point in the history
  • Loading branch information
24cteahan committed Nov 14, 2023
1 parent 227f90f commit 017efbf
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion HelpPage/doc/docs/apis/Gamepads.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,32 @@ There are two:
## Usage

To use the gamepads, use the method named `get` + the name of the button or stick.
Axes return `double` and buttons return `boolean`.
Axes return `double` and buttons return `boolean`.

## Button Registry

First you must enable the feature, so add this to the `construct()` function of the `OperationMode`:
```java
Devices.enableButtonRegistration();
```

To register a button, use the method `registerButton` in the `Devices` class.

```java
Devices.controller#.registerButton(GamepadRequestInput.Button , "Button Usage")
```

If a button isn't registered, or you attempt to register a button twice the opmode will fail.
To search for a button use the method `searchForButton` in the `Devices` class.

```java
Devices.controller#.buttonSearch("Button Usage")
```

See the Buttoner.java Opmode to see sample code

If you want a list of buttons and their uses, possibly to print to the driver station, use the method `getButtonRegistry` in the `Devices` class.

```java
Devices.genList();
```

0 comments on commit 017efbf

Please sign in to comment.