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

added web doc code #604

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
```
Loading