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

Moderator: igrr

User avatar
By martinayotte
#40573 I didn't look at you original code until now.
The watchdog reset is probably caused because you are doing calls to noInterrupts() and interrupts() with a Serial.println() between. You should not. Narrow the calls only around the "word p = pulse_433;", and you probably need some flag such "pinChanged" to process only when a change occured.
User avatar
By bkenobi
#40574 I've read that putting a Serial.print inside the interrupt is bad, but the way I'm using it I turn off interrupts, print, turn on interrupts. I wouldn't have thought that would be an issue. I will give it a try though. Thanks for the suggestion.
User avatar
By bkenobi
#40591 I modified the code as suggested and have tested it on 2 configurations:
[list=]NodeMCUv3 + SRX882
Wemos D1 + RXB6[/list]

Code: Select allvolatile word pulse_433;
word last_433 = 0;

void setup() {
    Serial.begin(115200);
    pinMode(D5,INPUT);
    attachInterrupt(D5, PinChange, CHANGE);
}

void PinChange() {
    word now = micros();
    pulse_433 = now - last_433;
    last_433 = now;
}

void loop() {
  noInterrupts();
  word p = pulse_433;
  pulse_433 = 0;
  interrupts();
 
  if (100<p && p<2000){
    Serial.print(micros());
    Serial.print(" ");
    Serial.println(p);
  }
}


With the NoceMCU, the code works without any issues in resets but the data is junk. With the Wemos D1, the code also works without issue and still the data is junk. So, I can say that Serial.print between noInterrups() and Interrupts() is definitely the issue I was having. The receivers don't appear to be seeing valid data with the current configuration, but that's a different issue that I'll look into.

This specific issue/topic can be closed. Thanks! :D
User avatar
By martinayotte
#40596 Glad to ear that watchdog issue is resolved !
Fro the data junk, beware that those RF433 receivers don't have some kind of "skelch", they produce random noise when idle, due to RF environment.
So, you need to get rid of that noise in software.
I didn't tried such thing under ESP, but maybe this library can help :
https://www.pjrc.com/teensy/td_libs_VirtualWire.html