Grove soundsensor lib

Embed: (wiki syntax)

« Back to documentation index

soundsensor Class Reference

soundsensor Class Reference

SoundSensor CLASS. More...

#include <soundsensor.h>

Public Member Functions

 soundsensor (PinName)
 FUNCTIONS AND CONSTRUCTOR.
void setPin (PinName pin)
 Set function to set pin where sound sensor is placed.
PinName getPin ()
 Get function to get pin where sound sensor is placed.
float convertToDb (float)
 Function to convert sound sensor input to DB.
float revertFromDb (float)
 Function to convert sound sensor DB to raw input.
float listen (bool toDb)
 Takes raw input from sound sensor returns Db or raw input depending of input parameter in function.

Detailed Description

SoundSensor CLASS.

Definition at line 33 of file soundsensor.h.


Constructor & Destructor Documentation

soundsensor ( PinName  pin )

FUNCTIONS AND CONSTRUCTOR.

Constructor that sets pin to to take analog input form.

Author:
Nikolaj M. & Mathias R.
Parameters:
pinThe pin that the sound sensor is placed
Date:
23/1/2019

Definition at line 18 of file soundsensor.cpp.


Member Function Documentation

float convertToDb ( float  value )

Function to convert sound sensor input to DB.

Author:
Nikolaj M. & Mathias R. value Input value from sound sensor.
Date:
23/1/2019

Definition at line 49 of file soundsensor.cpp.

PinName getPin (  )

Get function to get pin where sound sensor is placed.

Author:
Nikolaj M. & Mathias R.
Returns:
pin The pin that the sound sensor is placed
Date:
23/1/2019

Definition at line 39 of file soundsensor.cpp.

float listen ( bool  toDb )

Takes raw input from sound sensor returns Db or raw input depending of input parameter in function.

Author:
Nikolaj M. & Mathias R. toDb value that sets to true or false depending if return should be db og raw input.
Date:
23/1/2019

Run through for loop to get average of 100 readings to make an more avarage calculation

This calculation of db is not precise and reliable

This returns either db or raw input depending of paramater input of function

Definition at line 74 of file soundsensor.cpp.

float revertFromDb ( float  value )

Function to convert sound sensor DB to raw input.

Author:
Nikolaj M. & Mathias R. value DB value from sound sensor.
Date:
23/1/2019

CODE NEEDS TO BE IMPLEMENTED

Definition at line 60 of file soundsensor.cpp.

void setPin ( PinName  pin )

Set function to set pin where sound sensor is placed.

Author:
Nikolaj M. & Mathias R.
Parameters:
pinThe pin that the sound sensor is placed
Date:
23/1/2019

Definition at line 28 of file soundsensor.cpp.