Skip to content

attachInterrupt CHANGE acts like POSEDGE not ANYEDGE #322

Closed
@chaeplin

Description

@chaeplin

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions