433Mhz sender and IR receiver cannot be used simulatenously

I noticed my 433MHz sender not working anymore and tried narrowing the error down by using only minimal code but cannot seem to solve this problem any further. so my current code looks like this:

#include <IRremote.h>
#include <RCSwitch.h>

RCSwitch sender = RCSwitch();

void setup() {
  IrReceiver.begin(7, false);

  sender.enableTransmit(10);
  sender.setProtocol(4);
  sender.setPulseLength(520);
}

void loop() {
  sender.send(13961378, 24);
}

and i noticed my sender stops working as soon as i put the IrReceiver.begin() in the setup method. if i remove just this one line it starts working and I´m wondering what may causes this issue and how it is to be resolved.
thank you for any help in advance :slight_smile:

The libraries conflict over timer usage, almost certainly Timer1 if you are using Arduino Uno R3 or related (Nano, Mega, etc.). Check to see whether there are alternative libraries.

State which Arduino you are using.

1 Like

I´m currently using an Arduino Uno R3, I´m gonna see if there are any alternative libraries, thank you!

There may be alternative timer options in the libraries you are presently using. Check the source code.

Edit: I checked RCSwitch and it uses micros(), so Timer0, which should not conflict with IRremote. IRremote has several options for timer usage, but the real problem may have something to do with interrupt usage.

I haven't seen this problem before, so you will have to do an internet search to find better advice. There is this, which may or may not be helpful: IR Remote & RC Switch libraries incompatibility · Issue #111 · sui77/rc-switch · GitHub

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.