RSeries astromech firmware
MicrophoneAmplitude Class Reference

#include <MicrophoneAmplitude.h>

Detailed Description

Reads a microphone amplitude and makes it available as PeakValueProvider input.

+ Inheritance diagram for MicrophoneAmplitude:
+ Collaboration diagram for MicrophoneAmplitude:

Public Member Functions

 MicrophoneAmplitude (const byte analogPin=0, const int periodMillis=50)
 Default Constructor. More...
 
virtual void animate ()
 Reads the microphone connected to the analog port specified by the constructor and calculates the amplitude. More...
 
void setGain (byte gainFactor)
 Set the gain. More...
 
byte getPeakValue ()
 
unsigned int getRawSample ()
 
- Public Member Functions inherited from AnimatedEvent
 AnimatedEvent ()
 Default Constructor. More...
 
void setLoopDoneCallback (AnimatedLoopDone loopProc)
 
- Public Member Functions inherited from PeakValueProvider
 PeakValueProvider ()
 Default Constructor. More...
 

Protected Attributes

byte fPin
 
unsigned fPeriod
 
unsigned fSampleCount
 
unsigned long fStartPeriod
 
unsigned int fSample
 
unsigned int fSignalMax
 
unsigned int fSignalMin
 
byte fPeakToPeak
 
byte fGain
 
- Protected Attributes inherited from PeakValueProvider
byte fPeakValue
 

Additional Inherited Members

- Static Public Member Functions inherited from AnimatedEvent
static void process ()
 Calls animate() for each created AnimatedEvent subclass. More...
 
- Static Public Member Functions inherited from PeakValueProvider
static PeakValueProvidergetZero ()
 

Constructor & Destructor Documentation

◆ MicrophoneAmplitude()

MicrophoneAmplitude::MicrophoneAmplitude ( const byte  analogPin = 0,
const int  periodMillis = 50 
)
inline

Default Constructor.

Member Function Documentation

◆ animate()

virtual void MicrophoneAmplitude::animate ( )
inlinevirtual

Reads the microphone connected to the analog port specified by the constructor and calculates the amplitude.

Implements AnimatedEvent.

◆ getPeakValue()

byte MicrophoneAmplitude::getPeakValue ( )
inlinevirtual
Returns
last recorded peak value

Reimplemented from PeakValueProvider.

◆ getRawSample()

unsigned int MicrophoneAmplitude::getRawSample ( )
inline
Returns
last recorded raw sample

◆ setGain()

void MicrophoneAmplitude::setGain ( byte  gainFactor)
inline

Set the gain.

Member Data Documentation

◆ fGain

byte MicrophoneAmplitude::fGain
protected

◆ fPeakToPeak

byte MicrophoneAmplitude::fPeakToPeak
protected

◆ fPeriod

unsigned MicrophoneAmplitude::fPeriod
protected

◆ fPin

byte MicrophoneAmplitude::fPin
protected

◆ fSample

unsigned int MicrophoneAmplitude::fSample
protected

◆ fSampleCount

unsigned MicrophoneAmplitude::fSampleCount
protected

◆ fSignalMax

unsigned int MicrophoneAmplitude::fSignalMax
protected

◆ fSignalMin

unsigned int MicrophoneAmplitude::fSignalMin
protected

◆ fStartPeriod

unsigned long MicrophoneAmplitude::fStartPeriod
protected

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