I want to call some functions at the rising edge and falling edge of a square wave pulses. I used attachInterrupt(digitalPinToInterrupt(interruptPin), udara, RISING) for rising edge and attachInterrupt(digitalPinToInterrupt(interruptPin), blank,FALLING) for falling edge. But I didn`t get the serial outputs of rise and fall conservatively. what is the answer for the problem? My code is written as follows.
enter code here
const byte interruptPin = 2;
void setup() {
Serial.begin(9600);
pinMode(interruptPin, INPUT);
}
void loop() {
attachInterrupt(digitalPinToInterrupt(interruptPin), udara, RISING);
attachInterrupt(digitalPinToInterrupt(interruptPin), blank, FALLING);
}
void udara() {
Serial.println("rise");
}`
void blank() {
Serial.println("fall");
}