okapi::Potentiometer class

Base classes

class RotarySensor

Constructors, destructors, conversion operators

Potentiometer(std::uint8_t iport)
A potentiometer in an ADI port.
Potentiometer(std::pair<std::uint8_t, std::uint8_t> iports)
A potentiometer in an ADI port.

Public functions

auto get() const -> double override
Get the current sensor value.
auto controllerGet() -> double override
Get the sensor value for use in a control loop.

Protected variables

std::uint8_t smartPort
std::uint8_t port

Function documentation

okapi::Potentiometer::Potentiometer(std::uint8_t iport)

A potentiometer in an ADI port.

Parameters
iport The ADI port number ([1, 8], [a, h], [A, H]).
auto pot = Potentiometer('A');

okapi::Potentiometer::Potentiometer(std::pair<std::uint8_t, std::uint8_t> iports)

A potentiometer in an ADI port.

Parameters
iports The ports the potentiometer is plugged in to in the order {smart port, potentiometer port}. The smart port is the smart port number ([1, 21]). The potentiometer port is the ADI port number ([1, 8], [a, h], [A, H]).
auto pot = Potentiometer({1, 'A'});

double okapi::Potentiometer::get() const override

Get the current sensor value.

Returns the current sensor value, or PROS_ERR on a failure.

double okapi::Potentiometer::controllerGet() override

Get the sensor value for use in a control loop.

Returns the current sensor value, or PROS_ERR on a failure.

This method might be automatically called in another thread by the controller.