9. code - A-Division-2023-24-Odd/Repo-04 GitHub Wiki

code of device

  void setup() {
  
    pinMode(2,OUTPUT);// arduino on/ off led
    pinMode(5,OUTPUT);//disposal led
    pinMode(3,OUTPUT);// working in process led
    pinMode(11,INPUT);//ir sensor to detect can
    pinMode(9,OUTPUT);//dc
    pinMode(10,OUTPUT);//dc
    pinMode(22,INPUT);//ir sensor to detect  crushed can
    Serial.begin(9600);

}

void loop() 
{
  
   digitalWrite(2,HIGH);
   int ir=digitalRead(11);
   int i=digitalRead(22);
   if(ir==0)
   {

      digitalWrite(9,HIGH);
      digitalWrite(10,LOW); 
      digitalWrite(3,HIGH);
      delay(1000);
      digitalWrite(9,HIGH);
      digitalWrite(10,HIGH); 
      digitalWrite(3,LOW);
  delay(100);

   }
   
   if(i==0)
   {
     digitalWrite(5,HIGH);
     delay(1000);
     digitalWrite(5,LOW);
   }

}