FC-04 sound sensor - reads sound level as an analog value through a PCF8591 ADC channel.
More...
#include <SoundSensor.h>
FC-04 sound sensor - reads sound level as an analog value through a PCF8591 ADC channel.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
◆ SoundSensor()
| RumPi::SoundSensor::SoundSensor |
( |
unsigned int |
pcfBasePinNumber, |
|
|
int |
pcfI2CAddress |
|
) |
| |
Builds a sound sensor bound to the given PCF8591 base pin number and I2C address.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
SoundSensor(unsigned int pcfBasePinNumber, int pcfI2CAddress)
Builds a sound sensor bound to the given PCF8591 base pin number and I2C address.
Definition: SoundSensor.cpp:18
- Parameters
-
| [in] | pcfBasePinNumber | The PCF8591 base pin number this sensor reads from. |
| [in] | pcfI2CAddress | The PCF8591 I2C address. |
◆ ~SoundSensor()
| RumPi::SoundSensor::~SoundSensor |
( |
| ) |
|
|
virtual |
Destroys the sensor, turning it off first.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
◆ GetPCFBasePinNumber()
| unsigned int RumPi::SoundSensor::GetPCFBasePinNumber |
( |
| ) |
const |
Gets the PCF8591 base pin number this sensor reads from.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
unsigned int pin = soundSensor.GetPCFBasePinNumber();
- Returns
- The PCF8591 base pin number.
◆ GetPCFI2CAddress()
| int RumPi::SoundSensor::GetPCFI2CAddress |
( |
| ) |
const |
Gets the PCF8591 I2C address.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
int address = soundSensor.GetPCFI2CAddress();
- Returns
- The PCF8591 I2C address.
◆ ProcessRawValues()
| void RumPi::SoundSensor::ProcessRawValues |
( |
| ) |
|
|
overridevirtual |
No-op: the sound sensor reads its value on demand in ReadRawAnalogValue, so there are no raw values to process.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
soundSensor.ProcessRawValues();
Implements RumPi::BaseComponent.
◆ ReadRawAnalogValue()
| int RumPi::SoundSensor::ReadRawAnalogValue |
( |
| ) |
const |
Reads the raw analog sound value from the PCF8591 base pin.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
int value = soundSensor.ReadRawAnalogValue();
- Returns
- The raw analog sound value.
◆ ToString()
| std::string RumPi::SoundSensor::ToString |
( |
| ) |
const |
|
overridevirtual |
Serializes the sensor's PCF8591 base pin number and I2C address to a string.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
std::string data = soundSensor.ToString();
- Returns
- A multi-line string describing the sensor.
Implements RumPi::BaseComponent.
◆ TurnOff()
| void RumPi::SoundSensor::TurnOff |
( |
| ) |
|
|
overridevirtual |
No-op: the sound sensor holds no resources that need releasing when turned off.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
Implements RumPi::BaseComponent.
◆ TurnOn()
| void RumPi::SoundSensor::TurnOn |
( |
| ) |
|
|
overridevirtual |
No-op: the sound sensor is passive and reads on demand, so there is nothing to turn on.
- Author
- Eddie O'Hagan
- Date
- 8/13/2026
Implements RumPi::BaseComponent.
◆ myPCFBasePinNumber
| unsigned int RumPi::SoundSensor::myPCFBasePinNumber |
|
private |
The PCF8591 base pin number this sensor reads from.
◆ myPCFI2CAddress
| int RumPi::SoundSensor::myPCFI2CAddress |
|
private |
The documentation for this class was generated from the following files: