API Documentation

class eml_uberdriver::ARDevice

The ARDevice class is the base class used to interface with a connected eml_uberdriver Due.

ARDevice(int busnum, int address)

Constructs a new ARDevice connected to a Due.

Parameters:
  • busnum – The I2C bus this Due is connected to
  • address – The address the Due has on the I2C bus.
void openPinAsMotor(uint8_t pin)

Opens a pin on the Due as a PWM-controlled motor

Parameters:pin – The pin to open
void writeMicroseconds(uint8_t pin, uint16_t microSeconds)

Sets the PWM rate on an open motor pin.

Parameters:
  • pin – The motor pin to change PWM for
  • microSeconds – The duty cycle in microseconds to change to
eml_uberdriver::encoder_id_t openPinAsEncoderId(uint8_t pin1, uint8_t pin2)

Opens two pins on the Due as an encoder, returning the raw id (see :doc:`the protocol documentation <protocol.rst> for more information) of this new encoder.

Parameters:
  • pin1 – The first pin to open
  • pin2 – The second pin to open
Returns:

The raw encoder id

eml_uberdriver::Encoder openPinAsEncoder(uint8_t pin1, uint8_t pin2)

Opens two pins on the due as an encoder, returning an eml_uberdriver::Encoder instance representing this new encoder.

Parameters:
  • pin1 – The first pin to open
  • pin2 – The second pin to open
Returns:

The eml_uberdriver::Encoder instance representing this new encoder.

void resetEncoder(eml_uberdriver::encoder_id_t encoder)

Resets an encoder by its raw id.

Parameters:encoder – The raw id of the encoder to reset (also known as zeroing the encoder)
int32_t readEncoder(eml_uberdriver::encoder_id_t encoder)

Reads the value contained in an encoder by its raw id

Note

Encoder values are positive for clockwise, and negative for anticlockwise

Parameters:encoder – The raw id of the encoder to read
Returns:The number of ticks since the last reset of this encoder
class eml_uberdriver::Encoder
Encoder()

Constructs an unassigned eml_uberdriver::Encoder instance.

Danger

Using this constructor is only provided so global variables can initialize without needing a constructed eml_uberdriver::ARDevice instance available. Using any other method on an instance created with this constructor will cause an exception.

void resetEncoder()

Resets this encoder

int32_t encoderValue()

Gets number of ticks since last reset of this encoder.

Note

Encoder values are positive for clockwise, and negative for anticlockwise

Returns:The number of ticks since last reset of this encoder.