Page 75 - PROYECTO INTEGRADOR
P. 75
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(sonido,OUTPUT);
}
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);
digitalWrite(6,HIGH);
}
else
{
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
noTone(6);