Encoder components read quadrature encoder inputs.
More...
#include <encoders.hpp>
|
| void | begin (uint8_t encoder_index) |
| | Initializes the Encoder with the specified encoder index.
|
|
void | invert () |
| | Inverts the encoder direction. Useful for changing the direction without rewiring.
|
| DecimalPosition | read () |
| | Returns the current position of the encoder in world units.
|
|
void | reset () |
| | Resets the encoder position to zero.
|
| void | set (DecimalPosition value) |
| | Sets the encoder position to a specified value in world units.
|
| void | set_latch (DecimalPosition value_world_units, uint8_t min_or_max) |
| | Sets latching behavior for the encoder at specified world unit values.
|
|
void | set_ratio (float output_units, float encoder_units=1.0) |
|
void | enroll (RPC *rpc, const String &instance_name) |
|
|
BlockPort | output |
|
bool | min_latch_enabled = false |
|
bool | max_latch_enabled = false |
|
int32_t | min_latch_value = 0 |
|
int32_t | max_latch_value = 0 |
Encoder components read quadrature encoder inputs.
The Encoder class interfaces with quadrature encoders connected to the StepDance controller and allows mapping the encoder signals to Stepdance components. Here's an example of how to instantiate and configure an Encoder:
#define module_driver
#include "stepdance.hpp"
void setup(){
output_a.
begin(OUTPUT_A);
enable_drivers();
channel_a.
begin(&output_a, SIGNAL_E);
encoder.
begin(ENCODER_1);
encoder.set_ratio(24, 2400);
encoder.output.
map(output_a.input_position);
dance_start();
}
void loop(){
dance_loop();
}
◆ begin()
| void Encoder::begin |
( |
uint8_t | encoder_index | ) |
|
Initializes the Encoder with the specified encoder index.
- Parameters
-
| encoder_index | Index of the encoder to initialize (e.g., ENCODER_1, ENCODER_2, ENCODER_A). |
◆ read()
| DecimalPosition Encoder::read |
( |
| ) |
|
Returns the current position of the encoder in world units.
- Returns
- DecimalPosition Current position in world units.
◆ set()
| void Encoder::set |
( |
DecimalPosition | value | ) |
|
Sets the encoder position to a specified value in world units.
- Parameters
-
| value | Position value to set in world units. |
◆ set_latch()
| void Encoder::set_latch |
( |
DecimalPosition | value_world_units, |
|
|
uint8_t | min_or_max ) |
Sets latching behavior for the encoder at specified world unit values.
- Parameters
-
| value_world_units | The world unit value at which to set the latch. |
| min_or_max | Specify whether this is a minimum (0) or maximum (1) latch. |
The documentation for this class was generated from the following file: