Hi, I've download the MsTimer2 library, and I had add it to the folder library on the arduino, but when I tryed to inculde the library it doesnt apear...
Did you restart the IDE.
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...
but how could I do that delay inside the interrupt?
"delay" and "interrupt" are not friends.
I know that, but do you know how could I do that delay it need to works?
You need to post your code.