I have a Code I found that I wanted to use however I cant get the IR LED to work and the source doesn't indicate the version of IR remote library used
can anyone shed some light if im missing something or how to port the codes to make it work
Arduino Mega where the IR LED in pin D3
//==========================IR Library===========================//
#include <IRremote.h>
//================Configure The Input Pins======================//
#define pitch A11
#define roll A12
#define yaw A8
#define throttle A9
#define aux1 A13
#define aux2 A10
#define aux3 A14
#define aux4 A15
#define red 2 //RBG LED Is Comman Anode
#define blue 30
#define green 31
#define arm_disarm 13
IRsend irsend;//By Default The IR LED Is D3
int aux1val=0;
int aux2val=0;
int aux1TX=0;
int aux2TX=0;
//================Correction Variable===========//
/* If received value is not exactly middle(1500), include the +/- correction value*/
int PitchCorrection=0;
int RollCorrection=0;
int ThrottleCorrection=0;
int YawCorrection=0;
void setup() {
pinMode(pitch,INPUT);
pinMode(roll,INPUT);
pinMode(yaw,INPUT);
pinMode(throttle,INPUT);
pinMode(aux1,INPUT_PULLUP);
pinMode(aux2,INPUT_PULLUP);
pinMode(aux3,INPUT);
pinMode(aux4,INPUT);
pinMode(red,OUTPUT);
pinMode(blue,OUTPUT);
pinMode(green,OUTPUT);
pinMode(arm_disarm,OUTPUT);
digitalWrite(red,HIGH);
digitalWrite(blue,HIGH);
digitalWrite(green,HIGH);
digitalWrite(arm_disarm,LOW);
Serial.begin(9600);
}
void loop() {
//============Reading Joystick Analog Data===========//
int pitchVal=analogRead(pitch);
int rollVal=analogRead(roll);
int yawVal=analogRead(yaw);
int throttleVal=analogRead(throttle);
//===============Converting To 8Bit Values==========//
uint8_t pitchTX=map(pitchVal,0,1023,0,255)+PitchCorrection;
uint8_t rollTX=map(rollVal,0,1023,0,255)+RollCorrection;
uint8_t yawTX=map(yawVal,0,1023,0,255)+ThrottleCorrection;
uint8_t throttleTX=map(throttleVal,0,1023,0,255)+YawCorrection;
//=============Merging As Single 32Bit Data========//
uint32_t j1 = ((pitchTX<<8) | rollTX);
uint32_t j2 = (yawTX<<8) | throttleTX;
j2=j2 & 0x000FFFF;
uint32_t joystick = (j1<<16) | j2;
irsend.sendRC5(joystick,32); //Transmitting The Joystick Data
delay(26);
//=================Reading Aux1 Button===============//
if(digitalRead(aux1)==LOW)
{
aux1val++;
}
if(aux1val%2== 0)
{
aux1TX=0;
digitalWrite(arm_disarm,LOW);
}
else
{
digitalWrite(arm_disarm,HIGH);
aux1TX=255;
}
//=================Reading Aux2 Button===============//
if(digitalRead(aux2)==LOW)
{
aux2val++;
}
if(aux2val%3==0)
{
aux2TX=0;
digitalWrite(red,HIGH);
digitalWrite(blue,LOW);
digitalWrite(green,HIGH);
}
else if(aux2val%3==1)
{
aux2TX=127;
digitalWrite(red,HIGH);
digitalWrite(blue,HIGH);
digitalWrite(green,LOW);
}
else
{
aux2TX=255;
digitalWrite(red,LOW);
digitalWrite(blue,HIGH);
digitalWrite(green,HIGH);
}
//============Reading Analog Data============//
int aux3val=analogRead(aux3);
int aux4val=analogRead(aux4);
uint8_t aux3TX=map(aux3val,0,1023,0,255);
uint8_t aux4TX=map(aux4val,0,1023,0,255);
//=========Merging As Single 32Bit Data========//
uint32_t a1 = ((aux1TX<<8) | aux2TX);
uint32_t a2 = (aux3TX<<8) | aux4TX;
a2=a2 & 0x000FFFF;
uint32_t aux = (a1<<16) | a2;
irsend.sendNEC(aux,32);//Transmitting Signal
delay(26);
//=============Printing The Value============//
//=====uncomment to debug the output========//
Serial.print(pitchTX);Serial.print(" ");
Serial.print(rollTX);Serial.print(" ");
//Serial.print(throttleTX);Serial.print(" ");
//Serial.print(yawTX);Serial.print(" ");
//Serial.print(aux1TX);Serial.print(" ");
//Serial.print(aux2TX);Serial.print(" ");
//Serial.print(aux3TX);Serial.print(" ");
//Serial.print(aux4TX);Serial.print(" ");
//Serial.print(pitchTX);Serial.println();
}