Commanders
Arduino buttons/bus library
ButtonsCommanderPotentiometer Class Reference

#include "ButtonsCommanderPotentiometer.hpp"

Inheritance diagram for ButtonsCommanderPotentiometer:
ButtonsCommanderButton

Public Member Functions

 ButtonsCommanderPotentiometer ()
 
int GetPosition () const
 
void begin (unsigned long inId, int inPin, int inMinimum, int inMaximum, int inMoveAccuracy = 1)
 
void SetMiniMaxi (int inMini, int inMaxi, int inMoveAccuracy = 1)
 
unsigned long loop ()
 
- Public Member Functions inherited from ButtonsCommanderButton
 ButtonsCommanderButton (unsigned long inId)
 
unsigned long GetId () const
 
virtual ButtonsCommanderButton * GetFromId (unsigned long inId)
 
virtual void beforeFirstLoop ()
 
virtual void EndLoop ()
 
void SetNextButton (ButtonsCommanderButton *inpButton)
 
ButtonsCommanderButton * GetNextButton () const
 

Additional Inherited Members

- Protected Attributes inherited from ButtonsCommanderButton
unsigned long Id
 

Detailed Description

This class describes a potentiometer. This is an analog item, with a minimal, a maximal and a current analog value. An analog pin of the Arduino will retun a value between 0 and 1023. The current value of this item will be mapped from 0/1023 to minimum/maximum current value. An event will be thrown when a change of the value will be greater than moveAccuracy.

Events thrown:

reason id type data
value changed button id COMMANDERS_EVENT_MOVEPOSITION value

Definition at line 22 of file ButtonsCommanderPotentiometer.hpp.

Constructor & Destructor Documentation

ButtonsCommanderPotentiometer::ButtonsCommanderPotentiometer ( )

Default constructor.

Definition at line 11 of file ButtonsCommanderPotentiometer.cpp.

Member Function Documentation

void ButtonsCommanderPotentiometer::begin ( unsigned long  inId,
int  inPin,
int  inMinimum,
int  inMaximum,
int  inMoveAccuracy = 1 
)

Initialize the instance.

Parameters
inIdid of the button.
inPinArduino analog pin connected to this potentiometer.
inMinimumminimum value, when the Arduino pin returns 0.
inMaximummaximum value, when the Arduino pin returns value of 1023.
inMoveAccuracyminimum change value to throw a new event.

Definition at line 15 of file ButtonsCommanderPotentiometer.cpp.

int ButtonsCommanderPotentiometer::GetPosition ( ) const
inlinevirtual

Gets the current value.

Reimplemented from ButtonsCommanderButton.

Definition at line 35 of file ButtonsCommanderPotentiometer.hpp.

unsigned long ButtonsCommanderPotentiometer::loop ( )
virtual

Main loop function.

Reimplemented from ButtonsCommanderButton.

Definition at line 29 of file ButtonsCommanderPotentiometer.cpp.

void ButtonsCommanderPotentiometer::SetMiniMaxi ( int  inMini,
int  inMaxi,
int  inMoveAccuracy = 1 
)
inline

Change the mini/maxi values.

Parameters
inMiniminimum value, when the Arduino pin returns 0.
inMaximaximum value, when the Arduino pin returns value of 1023.
inMoveAccuracyminimum change value to throw a new event.

Definition at line 50 of file ButtonsCommanderPotentiometer.hpp.


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