Now I did it and is working fine, thanks, could you help me with somethin else?
I got this interrupt that is for a ultrasonic sensor, bu the ultrasonic needs a delay between two lines, one turns on and the otherone turns off the sound, but how could I do that delay inside the interrupt?
void ataque()
{
int i = 0;
digitalWrite(Vdd,HIGH);
int duration, distance;
digitalWrite(trig, HIGH);
delayMicroseconds(1000)
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
distance = (duration/2) / 29.1;
if (distance < 20)
{
Serial.println(distance);
Derecho.write(180);
Izquierdo.write(0);
}
}
Because I'm allways reading 0 distance, and perhaps is because of it...