Alcoholsensor

parent b571570b
//Alcohol Sensor = MQ-3
const int MQ3=0;
const int Buzzer=12;
const int LED=13;
int value;
void setup() {
Serial.begin(9600);
pinMode(MQ3, INPUT);
pinMode(Buzzer, OUTPUT);
pinMode(LED, OUTPUT);
digitalWrite(Buzzer,LOW);
digitalWrite(LED,LOW);
}
void loop()
{
value= analogRead(MQ3);
Serial.println(value);
if(value>600)
{
digitalWrite(Buzzer,HIGH);
digitalWrite(LED,HIGH);
Serial.print("Alcohol range is High ,Miner is Drunk ");
}else{
digitalWrite(Buzzer,LOW);
digitalWrite(LED,LOW);
Serial.print("Not Drunk ");
}
delay (500);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment