Second IOT Record
Second IOT Record
Components/Software Required:
– Buzzer .
– 1 Yellow LED {Light Emitting Diode}.
– Jumper Wires.
– Arduino Uno.
– Breadboard.
Procedure:
1. Gather components: Arduino board, buzzer, LED, resistor (220 ohms),
and jumper wires.
2. Connect the LED to a digital pin (e.g., pin 9) with a resistor to ground;
connect the buzzer to another digital pin (e.g., pin 8) and ground.
3. Power the Arduino by connecting it to a power source via USB or
external power.
4. In the Arduino IDE, write a program to turn on the LED when the buzzer
is off and vice versa.
5. Connect the Arduino to your computer and upload the code using the
IDE.
6. Activate the LED and check that the buzzer is off; then activate the
buzzer and ensure the LED turns off.
7. If issues arise, check connections, pin assignments, and component
functionality.
6-BTCS-B 2260406
Code:
// C++ code
//
const int buzzer = 11;
const int LED = 8;//buzzer to arduino pin 9
void setup(){
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
pinMode(LED,OUTPUT);
Serial.println("Enter the State");
String state = Serial.readString();// Set buzzer - pin 9 as an output
}
void loop(){
}
else{
digitalWrite(LED,1)
}
}
Results:
6-BTCS-B 2260406