29 lines
969 B
C++
29 lines
969 B
C++
/*
|
|
Sound sensor gives decibal value of sound that is sensed by your mobile's microphone.
|
|
|
|
You can reduce the size of library compiled by enabling only those modules that you want
|
|
to use. For this first define CUSTOM_SETTINGS followed by defining INCLUDE_modulename.
|
|
|
|
Explore more on: https://thestempedia.com/docs/dabble/phone-sensors-module/
|
|
*/
|
|
#define CUSTOM_SETTINGS
|
|
#define INCLUDE_SENSOR_MODULE
|
|
#include <DabbleESP32.h>
|
|
|
|
void setup() {
|
|
Serial.begin(115200); // make sure your Serial Monitor is also set at this baud rate.
|
|
Dabble.begin("Myesp32"); //set bluetooth name of your device
|
|
}
|
|
|
|
void loop() {
|
|
Dabble.processInput(); //this function is used to refresh data obtained from smartphone.Hence calling this function is mandatory in order to get data properly from your mobile.
|
|
print_Sound_data();
|
|
}
|
|
|
|
void print_Sound_data()
|
|
{
|
|
Serial.print("SOUND: ");
|
|
Serial.println(Sensor.getSoundDecibels(), 3);
|
|
Serial.println();
|
|
}
|