Grove soundsensor lib
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.
- Parameters:
-
pin The 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.
- Date:
- 23/1/2019
Definition at line 49 of file soundsensor.cpp.
| PinName getPin | ( | ) |
Get function to get pin where sound sensor is placed.
- 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.
- 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.
- 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.
- Parameters:
-
pin The pin that the sound sensor is placed
- Date:
- 23/1/2019
Definition at line 28 of file soundsensor.cpp.
Generated on Mon Jul 25 2022 22:26:59 by
1.7.2