#include <arpirobot/arduino/sensor/SingleEncoder.hpp>
|
void | applyDefaultState () override |
|
std::vector< uint8_t > | getCreateData () override |
|
void | handleData (const std::vector< uint8_t > &data) override |
|
void | setArduino (BaseArduinoInterface *arduino) |
|
void | setDeviceId (int deviceId) |
|
bool | sendData (const std::vector< uint8_t > &data) |
|
bool | sendData (const std::string &data) |
|
|
static std::vector< uint8_t > | stringToData (const std::string &str) |
|
bool | createDevice |
|
int | deviceId |
|
std::string | deviceName |
|
BaseArduinoInterface * | arduino = nullptr |
|
◆ SingleEncoder() [1/2]
arpirobot::SingleEncoder::SingleEncoder |
( |
int |
pin, |
|
|
bool |
useInternalPullup, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pin | The digital pin number this encoder is connected to |
useInternalPullup | Set to true to use the arduino's internal pullup resistor on this pin (if supported) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ SingleEncoder() [2/2]
arpirobot::SingleEncoder::SingleEncoder |
( |
std::string |
pin, |
|
|
bool |
useInternalPullup, |
|
|
bool |
createDevice = true , |
|
|
int |
deviceId = -1 |
|
) |
| |
- Parameters
-
pin | The pin number this encoder is connected to (prefix with letter A for analog pin) |
useInternalPullup | Set to true to use the arduino's internal pullup resistor on this pin (if supported) |
createDevice | Leave this true unless the device is hard-coded in arduino firmware |
deviceId | Set this to the hard-coded deviceId if createDevice is false |
◆ getPosition()
int32_t arpirobot::SingleEncoder::getPosition |
( |
| ) |
|
Get the position (tick count) for this encoder
- Returns
- The position in ticks
◆ getVelocity()
float arpirobot::SingleEncoder::getVelocity |
( |
| ) |
|
Get the current velocity from the encoder
- Returns
- The speed in ticks / sec
◆ setPosition()
void arpirobot::SingleEncoder::setPosition |
( |
int32_t |
currentPosition | ) |
|
Set the current tick count to the given value
- Parameters
-
currentPosition | The new tick value to set |
The documentation for this class was generated from the following file: