-
Notifications
You must be signed in to change notification settings - Fork 13.3k
attachInterrupt CHANGE acts like POSEDGE not ANYEDGE #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I second this issue: I was trying to get RC-Switch library to work with ESP8266 so that I can receive signals from a remote control. It didn't work. After debugging, it seems interrupt mode 'CHANGE' is not capturing all rising and falling edges, instead, it's capturing only one type of edge. |
same here.CHANGE is acting like RISING. temporary solution would be changing interrupt something like this if(L1_rising) { but this puts some overhead on ESP chip i think. |
Experienced same problem. |
Thanks for the reports, I've found the bug, fix coming up. |
|
ESP-12 / pin 12 grounded with switch.
IDE 1.6.1-esp8266-1 / mac osx --> Working --> ANYEDGE
IDE 1.6.5 / mac osx( 775e9d4..49c25b9 esp8266 -> origin/esp8266) ---> NOT --> POSEDGE
int pin1 = 14;
volatile int state = LOW;
void setup()
{
Serial.begin(38400);
pinMode(pin1, OUTPUT);
pinMode(12, INPUT_PULLUP);
attachInterrupt(12, blink, CHANGE);
}
void loop()
{
digitalWrite(pin1, state);
//
Serial.print("state: ");
Serial.print(state);
Serial.print("\tread : ");
Serial.println(digitalRead(12));
delay(500);
}
void blink()
{
state = !state;
}
result
IDE 1.6.1-esp8266-1 / mac osx --> Working
IDE 1.6.5 / mac osx( 775e9d4..49c25b9 esp8266 -> origin/esp8266) ---> NOT
1.6.1-esp8266-1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 1 read : 0 --> change
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 0 read : 1 --> change
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 1 read : 0 --> change
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 0 read : 1 --> change
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
775e9d4..49c25b9 esp8266 -> origin/esp8266
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 0 --> should be changed
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 1 read : 1
state: 1 read : 1
state: 1 read : 1
state: 1 read : 0 --> should be changed
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
state: 0 read : 0 --> should be changed
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 0 read : 0
state: 1 read : 1
state: 1 read : 1
state: 1 read : 1
state: 1 read : 1
state: 1 read : 1
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 1 read : 0
state: 0 read : 1
state: 0 read : 1
state: 0 read : 1
The text was updated successfully, but these errors were encountered: