LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
okapi::Potentiometer Class Reference

#include <potentiometer.hpp>

Inheritance diagram for okapi::Potentiometer:
okapi::RotarySensor okapi::ControllerInput< double >

Public Member Functions

 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.
 
virtual double get () const override
 Get the current sensor value.
 
virtual double controllerGet () override
 Get the sensor value for use in a control loop.
 
- Public Member Functions inherited from okapi::RotarySensor
virtual ~RotarySensor ()
 

Protected Attributes

std::uint8_t smartPort
 
std::uint8_t port
 

Detailed Description

Definition at line 12 of file potentiometer.hpp.

Constructor & Destructor Documentation

◆ Potentiometer() [1/2]

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

A potentiometer in an ADI port.

Parameters
iportThe ADI port number ([1, 8], [a, h], [A, H]).

◆ Potentiometer() [2/2]

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

A potentiometer in an ADI port.

auto pot = Potentiometer({1, 'A'});
Parameters
iportsThe 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]).

Member Function Documentation

◆ controllerGet()

virtual double okapi::Potentiometer::controllerGet ( )
overridevirtual

Get the sensor value for use in a control loop.

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

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

Implements okapi::ControllerInput< double >.

◆ get()

virtual double okapi::Potentiometer::get ( ) const
overridevirtual

Get the current sensor value.

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

Implements okapi::RotarySensor.

Member Data Documentation

◆ port

std::uint8_t okapi::Potentiometer::port
protected

Definition at line 55 of file potentiometer.hpp.

◆ smartPort

std::uint8_t okapi::Potentiometer::smartPort
protected

Definition at line 54 of file potentiometer.hpp.


The documentation for this class was generated from the following file: