IR Remote Won't Transmit with Mega

I have done everything I could think of to try to get the ir transmitter to work on the mega2560 with no results I hook it up to the uno board and have no issues. Any Thoughts? does it still need pin 3 on mega or a different pin?

Do you realise that we can’t see your code or your schematic?

or know what library you are using?

It will probably be a simple answer if you post your sketch

#include <IRremote.h>
  IRsend irsend;
  const unsigned long hexValue = 0x20DF8877;
void setup() {
  pinMode(switchPin, INPUT);
}

void loop() {
    irsend.sendNEC(hexValue, 32);
    Serial.println("IR Sent");
  delay(200);
}

Now this sketch above works for uno and transmits correctly just by connection ir to pin 3 and other pin to ground. but same configuration on mega and I get nothing.

Try pin 9

// Arduino Mega
#if defined(AVR_ATmega1280) || defined(AVR_ATmega2560)
//#define IR_USE_TIMER1 // tx = pin 11
#define IR_USE_TIMER2 // tx = pin 9
//#define IR_USE_TIMER3 // tx = pin 5
//#define IR_USE_TIMER4 // tx = pin 6
//#define IR_USE_TIMER5 // tx = pin 46

From 'a' Library

@jonathanrhcooper

Did this work?

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