Alcohol Detector

SRJT09202

Jugaadu's Uncle is in the traffic police. He visited Jugaadu's home. He told Jugaadu about his alcohol detector that was broken in an accident which he had submitted for restoration. Restoration might take more than 3 days but he needs it by today. He asked Jugaadu if he can make something for the replacement. How can you help Jugaadu?

Jugaadu?

Bag Items:

  1. MQ 3 sensor
  2. RGB LED
  3. Breadboard
  4. Arduino UNO UNO
  5. Jumper Cables
  6. USB cable
  7. Battery and DC Jack
  8. Foam sheets
  9. Paper
  10. Gluegun
  11. Tape
  12. Cutter
  13. Buzzer

    int r=3;
int g=5;
int b=6;
int buzz=11;
int alch=8;

void setup() {
// put your setup code here, to run once:
pinMode(r,OUTPUT);
pinMode(g,OUTPUT);
pinMode(b,OUTPUT);
pinMode(buzz,OUTPUT);
pinMode(alch,INPUT);
analogWrite(4,255);

Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:

Serial.print(analogRead(A0));
Serial.println(digitalRead(alch) );
if(digitalRead(alch) ){

analogWrite(r,255);
analogWrite(g,0);
analogWrite(b,255); 
digitalWrite(buzz,0);

}else{
analogWrite(r,0);
analogWrite(g,255);
analogWrite(b,255);
digitalWrite(buzz,1);
}
}