Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | List of all members
SteppedPot Class Reference

Connect a stepped potentiometer. More...

#include <SteppedPot.h>

Inheritance diagram for SteppedPot:
BelaSteppedPot

Public Member Functions

 SteppedPot (const std::vector< float > &levelsV, float toleranceV, float fullScale=1)
 
void setup (const std::vector< float > &levelsV, float toleranceV, float fullScale=1)
 
bool process (float value)
 
unsigned int get ()
 

Detailed Description

Connect a stepped potentiometer.

It processes input signals to determine what step the pot is currently at. It can be used also with non-stepped potentiometers (or anything else, really, including a GUI slider) where a stepped behaviour is desired.

Constructor & Destructor Documentation

SteppedPot::SteppedPot ( const std::vector< float > &  levelsV,
float  toleranceV,
float  fullScale = 1 
)

Same as setup().

Member Function Documentation

void SteppedPot::setup ( const std::vector< float > &  levelsV,
float  toleranceV,
float  fullScale = 1 
)

Set up the stepped potentiometer.

Parameters
levelsVa vector of values corresponding to the approximate reading of each of the pot's positions.
toleranceVthe bipolar tolerance around each of the values in levelsV
fullScalea scaling factors for levelsV and toleranceV.
bool SteppedPot::process ( float  value)

Process a new reading from the potentiometer.

Returns
true if the pot has changed position, false otherwise.
unsigned int SteppedPot::get ( )

Get the current position of the pot.

Returns
the current position of the pot.
Examples:
Sensors/stepped-pot/render.cpp.

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