A generic class representing a simple analog input. More...
#include <PqInputs.h>


Public Member Functions | |
| AnalogIn (uint8_t pin, Engine &engine=Engine::primary()) | |
| Constructor. | |
| AnalogIn (uint8_t pin, uint8_t mode, Engine &engine=Engine::primary()) | |
| virtual float | get () |
| Returns value in [0, 1]. | |
| virtual float | mapTo (float toLow, float toHigh) |
| Maps value to new range. | |
| float | read () const |
| Direcly reads value from the pin (bypasses mode, smoothing, and engine). | |
| int | rawRead () const |
| Directly reads raw value from the pin (bypasses mode, smoothing, and engine). | |
| virtual void | clearEvents () |
| float | seconds () const |
| Returns engine time in seconds. | |
| uint32_t | milliSeconds () const |
| Returns engine time in milliseconds. | |
| uint64_t | microSeconds () const |
| Returns engine time in microseconds. | |
| unsigned long | nSteps () const |
| Returns number of engine steps. | |
| float | sampleRate () const |
| Returns engine sample rate. | |
| float | samplePeriod () const |
| Returns enginesample period. | |
| operator float () | |
| Object can be used directly to access its value. | |
| virtual float | put (float value) |
| Pushes value into the unit. | |
| operator bool () | |
| Operator that allows usage in conditional expressions. | |
| uint8_t | pin () const |
| Returns the pin this component is attached to. | |
| uint8_t | mode () const |
| Returns the mode of the component. | |
| virtual void | mode (uint8_t mode) |
| Changes the mode of the component. | |
| virtual void | smooth (float smoothTime=PLAQUETTE_DEFAULT_SMOOTH_WINDOW) |
| Apply smoothing to object. | |
| virtual void | noSmooth () |
| Remove smoothing. | |
| virtual void | timeWindow (float seconds) |
| Changes the smoothing window (expressed in seconds). | |
| float | timeWindow () const |
| Returns the smoothing window (expressed in seconds). | |
| virtual void | cutoff (float hz) |
| Changes the smoothing window cutoff frequency (expressed in Hz). | |
| float | cutoff () const |
| Returns the smoothing window cutoff frequency (expressed in Hz). | |
Protected Member Functions | |
| virtual void | begin () |
| virtual void | step () |
| virtual float | _read () |
| virtual float | _sampleRate () const |
| virtual bool | eventTriggered (EventType eventType) |
| Returns true iff an event of a certain type has been triggered. | |
| virtual void | onEvent (EventCallback callback, EventType eventType) |
| Registers event callback. | |
| Engine * | engine () const |
| Returns the engine that owns this unit. | |
| virtual void | _begin () |
| virtual void | _step () |
| virtual float | _smoothed () |
Protected Attributes | |
| uint8_t | _pin |
| uint8_t | _mode |
| MovingAverage | _avg |
A generic class representing a simple analog input.
| pq::AnalogIn::AnalogIn | ( | uint8_t | pin, |
| Engine & | engine = Engine::primary() |
||
| ) |
Constructor.
| pin | the pin number |
| mode | the mode (DIRECT or INVERTED) |
|
protectedvirtual |
Implements pq::Smoothable.
|
inlineprotectedvirtual |
Implements pq::Smoothable.
|
protectedvirtual |
Reimplemented from pq::Unit.
|
inlineprotectedvirtualinherited |
Returns true iff an event of a certain type has been triggered.
Reimplemented in pq::AbstractWave, pq::Alarm, pq::Metronome, pq::PeakDetector, pq::DigitalSource, pq::Ramp, pq::StreamIn, and pq::TimeSliceField< COUNT >.
|
inlinevirtual |
Returns value in [0, 1].
Reimplemented from pq::Chainable.
|
virtual |
Maps value to new range.
Reimplemented from pq::Chainable.
|
inlinevirtualinherited |
Changes the mode of the component.
Reimplemented in pq::DigitalIn, and pq::DigitalOut.
|
inlinevirtualinherited |
Pushes value into the unit.
| value | the value sent to the unit |
Reimplemented in pq::Chronometer, pq::MinMaxScaler, pq::Normalizer, pq::PeakDetector, pq::DigitalUnit, pq::AnalogOut, pq::AbstractServoOut, pq::Ramp, pq::Smoother, pq::StreamOut, pq::PivotField, and pq::TimeSliceField< COUNT >.
|
protectedvirtual |
Reimplemented from pq::Unit.