Arduino code:
/*
code started
#define Sensor pin = A0;
#define relay pin = D9;
#define Buzzer Pin = D8;
code created by Innovative ideas
For any help DM on
https://www.instagram.com/innovative_ideas_yt/?hl=en
*/
#define sensorDigital A0
#define relay 9
#define buzzer 8
#define sensorAnalog A1
void setup() {
pinMode(sensorDigital, INPUT);
pinMode(relay, OUTPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}
void loop() {
bool digital = digitalRead(sensorDigital);
int analog = analogRead(sensorAnalog);
Serial.print("Analog value : ");
Serial.print(analog);
Serial.print("t");
Serial.print("Digital value :");
Serial.println(digital);
if (digital == 0) {
digitalWrite(relay, LOW);
digitalWrite(buzzer, HIGH);
delay(5000);
digitalWrite(relay, HIGH);
digitalWrite(buzzer, LOW);
} else {
digitalWrite(relay, HIGH);
digitalWrite(buzzer, LOW);
}
}
8 Comments
Bhai code shi nhi h
ReplyDeleteSir is project ka coding error dy raha ha kisi k pass correct coding ha to plz send kar dan
DeleteBro kaise bnae model phir,
DeletePlz help!
shi code bhej do yrr
ReplyDeleteKaise bnae model
DeleteAdriano nano use kar rahi hu par code error aa raha hai please send the correct code
ReplyDeleteKaise bna model phir?
DeleteCode galat nahi A0 ko A1 kardo code run ho jaye ga...
ReplyDelete#define Sensor pin = A1;
#define relay pin = D9;
#define Buzzer Pin = D8;
#define sensorDigital A1
#define relay 9
#define buzzer 8
#define sensorAnalog A1
void setup() {
pinMode(sensorDigital, INPUT);
pinMode(relay, OUTPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}
void loop() {
bool digital = digitalRead(sensorDigital);
int analog = analogRead(sensorAnalog);
Serial.print("Analog value : ");
Serial.print(analog);
Serial.print("t");
Serial.print("Digital value :");
Serial.println(digital);
if (digital == 0) {
digitalWrite(relay, LOW);
digitalWrite(buzzer, HIGH);
delay(5000);
digitalWrite(relay, HIGH);
digitalWrite(buzzer, LOW);
} else {
digitalWrite(relay, HIGH);
digitalWrite(buzzer, LOW);
}
}