I've got a pulse coming in on pin 0 and trying to measure the pulse width.
I'm using ISR on the falling and rising edge of the same pin but it looks like the ISR is only calling on the rising edge.
Can I use attachInterrupt() twice on the same pin on both FALLING and RISING ?
Code:
int led = 13;
int rx_pin = 0;
void setup()
{
pinMode(led, OUTPUT);
pinMode(rx_pin, INPUT);
attachInterrupt(digitalPinToInterrupt(rx_pin),fallingISR,FALLING);
attachInterrupt(digitalPinToInterrupt(rx_pin),risingISR,RISING);
Serial.println("Ready..");
}
void loop()
{
}
void fallingISR()
{
Serial.println("fallingISR");
digitalWrite(led, HIGH);
}
void risingISR()
{
Serial.println("risingISR");
digitalWrite(led, LOW);
}