Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Hackster is hosting Impact Spotlights: Industrial Automation. Watch the stream live on Thursday!Hackster is hosting Impact Spotlights: Industrial Automation. Stream on Thursday!
Khaled Md Saifullah
Published © MIT

Arduino Basic Project-#7

I am going to share a very interesting project on Arduino. This project is all about the potentiometer controlled led & buzzer.

BeginnerFull instructions provided30 minutes1,274
Arduino Basic Project-#7

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Buzzer
Buzzer
×1
5 mm LED: Red
5 mm LED: Red
×2
Jumper wires (generic)
Jumper wires (generic)
×10

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Arduino-Basic-Project-#7-fritzing-file

Schematics

Arduino-Basic-Project-#7-circuit-diagram

Code

Arduino-Basic-Project-#7-Code

Arduino
// Date: 23/11/21
// Khaled Md. Saifullah
// KastTech

int greenLed = 6;
int redLed = 7;
int buzzPin = 5;
int potPin = A0;
int potValue;

void setup() {
  
  pinMode(greenLed, OUTPUT);
  pinMode(redLed, OUTPUT);
  pinMode(buzzPin, OUTPUT);
  pinMode(potPin, INPUT);
  Serial.begin(9600);
}

void loop() {

  potValue = analogRead(potPin);
  Serial.println(potValue);
  delay(1000);
  if (potValue >= 700) {
    digitalWrite(redLed, HIGH);
    digitalWrite(buzzPin, HIGH);
    digitalWrite(greenLed, LOW);
  } else {
    digitalWrite(greenLed, HIGH);
    digitalWrite(redLed, LOW);
    digitalWrite(buzzPin, LOW);
  }
}

Credits

Khaled Md Saifullah
18 projects • 44 followers
🦸Tech Enthusiast 👨🏾‍💻Programmer 📳IoT Specialist
Contact

Comments

Please log in or sign up to comment.