sui77 / rc-switch

Arduino lib to operate 433/315Mhz devices like power outlet sockets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not receiving (fix offered included here)

ThreepE0 opened this issue · comments

Noticed that in RCSwitch.cpp the pin mode is set when enableTransmit is called. Pin mode is not set on receive. I set the pin mode manually in my sketch uploaded to a Uno Wifi Rev 2 (using pin 3) and it started working great.

Noticed exists:
void RCSwitch::enableTransmit(int nTransmitterPin) { this->nTransmitterPin = nTransmitterPin; pinMode(this->nTransmitterPin, OUTPUT); }

Suggested addition in the enableReceive function:
void RCSwitch::enableReceive() { if (this->nReceiverInterrupt != -1) { RCSwitch::nReceivedValue = 0; RCSwitch::nReceivedBitlength = 0; #if defined(RaspberryPi) // Raspberry Pi wiringPiISR(this->nReceiverInterrupt, INT_EDGE_BOTH, &handleInterrupt); #else // Arduino attachInterrupt(digitalPinToInterrupt(this->nReceiverInterrupt), handleInterrupt, CHANGE); pinMode(this->nTransmitterPin, INPUT); #endif }

Sorry I do not know how to perform a pull request

Hi, I probably experiencing the same issue, can you please share you RCSwitch.cpp code via https://gist.github.com ?