Previous
incremental
A single
encoder sends a signal from the rotating encoder over a single wire to one pin on the board.
The direction of spin is dictated by the motor that has this encoder’s name in its encoder
attribute field.
To be able to test the encoder as you configure it, connect the encoder to your machine’s computer and power both on. Then, configure the encoder:
{
"name": "<your-encoder-name>",
"model": "single",
"type": "encoder",
"namespace": "rdk",
"attributes": {
"pin": <int>,
"dir_flip": <boolean>
}
}
{
"name": "<your-encoder-name>",
"model": "single",
"type": "encoder",
"namespace": "rdk",
"attributes": {
"pin": 22,
"dir_flip": false
}
}
The following attributes are available for single
encoders:
Name | Type | Required? | Description |
---|---|---|---|
pin | object | Required | GPIO number of the pin to which the encoder is wired. |
dir_flip | boolean | Required | If the encoder’s count should increment or decrement in its initial state before a SetPower() call is made to an encoded motor. true implies decrement. |
Once your encoder is configured and connected, open the encoders’s TEST panel on the CONFIGURE or CONTROL tabs. The ticks count is displayed. Try moving the encoder (for example, by turning a motor it is attached to) and check whether the count increases as expected.
If the encoder does not appear on the TEST panel, or if you notice unexpected behavior, check your machine’s LOGS tab for errors, and review the configuration.
If your encoder is not working as expected, follow these steps:
If none of these steps work, reach out to us on the Community Discord and we will be happy to help.
For more configuration and usage info, see:
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!