I just wanted to control LED and buzzer with Bluetooth to finally do the last assignment
software i used it to write the code of my
LMS 35 Temperature sensor
software to simulate my circuit and try it.
ATMega hardware arduino
char incomingdata = 0;
#define buzzer 3
#define Led 2
void setup(){
pinMode(buzzer, OUTPUT);
pinMode (Led, OUTPUT);
Serial.begin(9600);}
void loop() {
while (Serial.available() > 0)
incomingdata = Serial.read();
if (incomingdata == '1') {
digitalWrite(Led, HIGH);
}
else if (incomingdata == '2') {
tone(buzzer, 1000, 100);
delay(1000);
tone(buzzer, 1000, 1000);
}
else if (incomingdata == '3') {
digitalWrite(Led, HIGH);
tone(buzzer, 1000, 100);
delay(1000);
tone(buzzer, 1000, 1000);
}
else {
digitalWrite(Led, LOW);
noTone(buzzer);
} }
I wanted mainly if i click one
turn on led
if I clicked 2
buzzer generate sound.
and Finally i controlled LED and buzzer wi
I keep trying to rewrite the code and rewiring for more than one hour, but when I posted my code on slack MARWA YASSER find out a bug in the code and the project worked after her comment
A lot of mistakess xD
i wrote Serial.print(9600);}
i should write Serial.begin(9600);}
I wrote while (Serial.available() == 0)
i should write Serial.begin(9600);}
i wish i can make the AIR POLLUTION warner wirelessly