-->
Page 1 of 1

Interrupt issue with Wemos D1 R1

PostPosted: Sat Mar 12, 2022 3:07 am
by Jibeji
Hello,
I am trying to count the pulses of an external device with this simple sketch:

Code: Select all#define cpmPin 3
int count = 0;

void ICACHE_RAM_ATTR impulseCount(void) {
  count++;
}

void setup() {
    Serial.begin(115200);
    Serial.println("Setup");
    pinMode(cpmPin, INPUT_PULLUP);
    attachInterrupt(digitalPinToInterrupt(cpmPin), impulseCount, FALLING);
    Serial.println("End Setup");
}

void loop() {
  Serial.print("Count: ");
  Serial.println(count);
  delay(5000);
}


The counter does not increment whatever happens on pin 3.

Just to ensure my board was not failing with pin 3, I changed to pin 6 and got every 5 seconds:

ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 3460, room 16
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4
tail 4
chksum 0xc9
csum 0xc9
v00042070
~ld
Setup


Am I doing something wrong?

Re: Interrupt issue with Wemos D1 R1

PostPosted: Tue Mar 15, 2022 1:13 am
by Jibeji
Answering myself, it works with D4 but with none of the other digital input, strange...