Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By walders
#90185 Thanks, I'm using nodeMCU v3 LoLin device.

Strange behaviour, I've tried all other gpio without any success in picking up sensor event! The code at least runs at startup on the other input digital pins. Just the sensor events are not picked up at all?
User avatar
By QuickFix
#90199 Try this instead:
  • Put the sensor to GPIO13 (= D7 on the NodeMCU)
  • Replace the setup() code with this:
    Code: Select allvoid setup()
      pinMode(13, INPUT); // probe output on pin 13
      attachInterrupt(digitalPinToInterrupt(13), isr, RISING);
      numPulses = 0; // prime the system to start a new reading
(BTW: Shouldn't you have set the pinMode to INPUT instead of OUTPUT?) :?
User avatar
By walders
#90203 Thanks @QuickFix, brill, this works :D Yes, you're right, should have use input. Also should of have checked the gpio pin reference which can be found here:

Thanks also for "attachInterrupt(digitalPinToInterrupt(13)" didn't know about that