Programas y diseño Arduino. Cristhian Briones Pin | Page 14
Serial.println(d);
Serial.println(" cm");
delay(1000);
if (d >=r && d <=i){
{
if (d >=r && d <=(r+i))
{
digitalWrite(diodo1,HIGH),
digitalWrite(diodo2,LOW);
digitalWrite(diodo3,LOW);
digitalWrite(diodo4,LOW);
}
if ( d>=(r+d) && d<=(r+(2*d)))
{
digitalWrite(diodo1,HIGH);
digitalWrite(diodo2,HIGH);
digitalWrite(diodo3,LOW);
digitalWrite(diodo4,LOW);
}
if ( d>=(r+(2*d)) && d<=(r+(3*d)))
{
digitalWrite(diodo1,HIGH);
digitalWrite(diodo2,HIGH);
digitalWrite(diodo3,HIGH);
digitalWrite(diodo4,LOW);
}
if ( d>= (r+(3*d))&&d