Alcohol detecting system


 Arduino code:

/*

code started

   #define Sensor pin = A0;

      #define Motor pin = D8;

       code created by Innovative ideas team

        For any help  DM on

        https://www.instagram.com/innovative_ideas_yt/?hl=en https://api.whatsapp.com/send?phone=916000180664                https://youtube.com/c/TechnicalidEas07

         */ 

      

 #define sensorDigital A0

#define Motor 9

#define buzzer 8

#define sensorAnalog A1

void setup() {

  pinMode(sensorDigital, INPUT);

    pinMode(Motor, 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(Motor, LOW);

          digitalWrite(buzzer, HIGH);

            } else {

                digitalWrite(Motor, HIGH);

                    digitalWrite(buzzer, LOW);

                      }

                      }

Post a Comment

2 Comments