Week 6 Xu- Translate sound into light

Goal:

I want to hook up the sound sensor to an array of LED lights which will beat with music, clapping or knocking.

Components:

– Arduino Board
– Sound Sensor
– LED
– 220 ohm Resistors
– Mini Breadboard
– Wires

Connections :

Code :

int soundSensor = 2;
int LED = 3;

void setup() 
{

  pinMode (soundSensor, INPUT);
  pinMode (LED, OUTPUT);
}

void loop()
{
  int statusSensor = digitalRead (soundSensor);
  
  if (statusSensor == 1)
  {
    digitalWrite(LED, HIGH);
  }
  
  else
  {
    digitalWrite(LED, LOW);
  }
  
}

Leave a Reply

Your email address will not be published. Required fields are marked *