Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By alkor_r37
#74512 Hello.. I'm trying read a pulse on D0 pin with pulseIn function.. Unfortunately, it gives me zero.. I have done some research and found that this function works only with D3, D4 pins.. Is it possible to work with other pins ?(

Code: Select all#define FANGET D2
#define FANSET D1

void setup() {
  Serial.begin(115200);
  analogWriteFreq(25000);
  analogWrite(FANSET, 70);
  pinMode(FANGET, INPUT);
}

void loop() {
  unsigned int pulse = pulseIn(FANGET, LOW);
  Serial.println(pulse);
  delay(100);
}
User avatar
By btidey
#74547 Can you post link to that research?

I don't see any reason why the code for pulseIn (core_esp8266_wiring_pulse.c) should be pin specific.

A value of 0 indicates a timeout either waiting for pulse or in the pulse itself. You can set the timeout value yourself in the pulseIn call. I think the default is 1 second which is probably as high as you want to go without risking watchdog resets.