我怎样才能检测到中断已经发生以及中断是上升还是下降?在同一个引脚上有两个中断,就像下面的代码一样,是行不通的。
代码:
全选void setup() {
WiFi.forceSleepWake();
delay(100);
Serial.begin(1000000); pinMode( LED, OUTPUT );
pinMode( interruptPin, INPUT );
//attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterrupt, CHANGE);
attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterruptR, RISING);
attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterruptF, FALLING);
Serial.println("nStart");
}
ICACHE_RAM_ATTR void handleInterruptR() {
digitalWrite( LED, HIGH );
}
ICACHE_RAM_ATTR void handleInterruptF() {
digitalWrite( LED, LOW );
}