Arduino Beginner Series: Project 7: Turn LED on/off with a clap

Hello everyone!! Welcome to this post on Arduino LED Projects!!
Need a short introduction to what the Arduino is then click on LINK
Check out the breadboard intro right HERE

So Let’s get started!!

Demo:

This is what my project looks like:

Things Required:

  1. Arduino UNO
  2. LED (any colour)
  3. Breadboard
  4. 220 ohm resistor
  5. KY-038 sound sensing module
  6. Jumper Wires
  7. Arduino IDE on computer

Functions Used:

  1. digitalRead()
  2. digitalWrite()

Reference Material:

I used the following (LINK) as a reference.

Code:

int led=9;
int sound=10;
int j=0;

void setup() {
  // put your setup code here, to run once:
  pinMode(led, OUTPUT);
  pinMode(sound, INPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  if(digitalRead(sound)==HIGH){
    j++;
  }

  if(j%2==0){
    digitalWrite(led, LOW);
  }

  if(j%2!=0){
    digitalWrite(led,HIGH);
  }

}

Stay Tuned for upcoming posts on Arduino Projects! We’re on the basic newbie projects right now and slowly, gradually move on to those cool, ultra techy projects!! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!

Happy Learning!!

Leave a Reply

PHP JS HTML CSS BASH PYTHON CODE

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: