Page 70 - PROYECTO INTEGRADOR
P. 70

}

                  void loop ()

                  {




                    digitalWrite(trig , HIGH);

                    delay(1);

                    digitalWrite(trig, LOW);




                    t = pulseIn(echo, HIGH);

                    d= t/58.2;



                    if(d<150){


                    digitalWrite(4,HIGH);

                    digitalWrite(5,HIGH);

                    }




                    else

                    {

                      digitalWrite(4,LOW);

                      digitalWrite(5,LOW);






                    Serial.println("cm");

                    Serial.print(d);

                    delay(400);


                  }

                  }
   65   66   67   68   69   70   71   72   73   74   75