RSeries astromech firmware
SoftPot Class Reference

#include <core/SoftPot.h>

Detailed Description

Encapsulate a soft potentiometer. Value is read once every cycle.

Example usage:

SoftPot softPot(A0);
Serial.println(softPot.getValue());
+ Inheritance diagram for SoftPot:
+ Collaboration diagram for SoftPot:

Public Member Functions

 SoftPot (const byte pin)
 Default Constructor. More...
 
virtual int getValue ()
 
virtual void setup () override
 Setup pin mode for analog read. More...
 
virtual void animate () override
 Read the pot once through the loop. More...
 
- Public Member Functions inherited from SetupEvent
 SetupEvent ()
 Default Constructor. More...
 

Protected Attributes

byte fPin
 
int fValue
 

Additional Inherited Members

- Static Public Member Functions inherited from SetupEvent
static void ready ()
 Calls setup() for each created AnimatedEvent subclass. More...
 

Constructor & Destructor Documentation

◆ SoftPot()

SoftPot::SoftPot ( const byte  pin)
inline

Default Constructor.

Member Function Documentation

◆ animate()

virtual void SoftPot::animate ( )
inlineoverridevirtual

Read the pot once through the loop.

Implements AnimatedEvent.

◆ getValue()

virtual int SoftPot::getValue ( )
inlinevirtual
Returns
last read value

◆ setup()

virtual void SoftPot::setup ( )
inlineoverridevirtual

Setup pin mode for analog read.

Implements SetupEvent.

Member Data Documentation

◆ fPin

byte SoftPot::fPin
protected

◆ fValue

int SoftPot::fValue
protected

The documentation for this class was generated from the following file:
SoftPot
Encapsulate a soft potentiometer. Value is read once every cycle.
Definition: SoftPot.h:21