upm  1.3.0
Sensor/Actuator repository for libmraa (v1.7.0)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Attributes
Loudness Class Reference

API for the Loudness Sensor. More...

Detailed Description

This sensor family returns an analog voltage proportional to the loudness of the ambient environment. It's output does not correspond to a particular sound level in decibels. The higher the output voltage, the louder the ambient noise level.

This device uses an electret microphone for sound input.

This driver was developed using the DFRobot Loudness Sensor V2 and the Grove Loudness sensor.

// Instantiate a Loudness sensor on analog pin A0, with an analog
// reference voltage of LOUDNESS_AREF
upm::Loudness *loud = new upm::Loudness(0, LOUDNESS_AREF);
// Every tenth of a second, sample the loudness and output it's
// corresponding analog voltage.
while (shouldRun)
cout << "Detected loudness (volts): " << loud->loudness() << endl;

Public Member Functions

 Loudness (int pin, float aref=5.0)
 ~Loudness ()
float loudness ()

Protected Attributes

mraa::Aio m_aio

Constructor & Destructor Documentation

Loudness ( int  pin,
float  aref = 5.0 

Loudness constructor

pinAnalog pin to use
arefAnalog reference voltage; default is 5.0 V
~Loudness ( )

Loudness destructor

Member Function Documentation

float loudness ( )

Returns the voltage detected on the analog pin

The detected voltage

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