Categories

Arduino esplora sound level indicator

In this example we use an Arduino Esplora nad use the on board micropone and RGB led and create a sound level project, if the sound level is an acceptable level then the RGB led will be green, if the value exceeds this level we will change the RGB led to red.

esplora

esplora

 

Code

This example uses some of the built in esplora functions, namely the readMicrophone and writeRGB ones

#include <Esplora.h>
 
void setup()
{
  Serial.begin(9600);
} 
 
void loop()
{
  int value = Esplora.readMicrophone();
  Esplora.writeRGB(0, 0, 0);
  Serial.println(value);
  if(value < 100)
  {
      Esplora.writeRGB(0, 255, 0);
      delay(100);
  }
  else
  {
      Esplora.writeRGB(255, 0, 0);
      delay(100);
  }
  delay(100);
}
Share

Comments are closed.