First of all, I'm using GitHub - Arduino-IRremote/Arduino-IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols , not the built in IRremote libary.
I'm trying to use the sendPronto function in IRremote.h but I get this error and I don't know why:
C:\Users\ALEXAN~1\AppData\Local\Temp\ccbmPhPT.ltrans0.ltrans.o: In function `loop':
C:\Users\Alexander\Documents\Arduino\test/test.ino:107: undefined reference to `IRsend::sendPronto(char*, bool, bool)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Nano.
Here is my code:
//Ir libaries
#include <IRremoteInt.h>
#include <IRremote.h>
#include <boarddefs.h>
//Is useful
#include <Streaming.h>
//Some numbers used to keep track of what the user wants to send
#define TYPE_NEC 0
#define TYPE_LG 1
#define TYPE_PRONTO 2
#define TYPE_ERROR 3
String inputBuffer; //Store recieved text
char buf; //Store 1 recieved character
char inputStr[30]; //Convert C sting to char. Also stores the code that the user wants to send.
char outputType [7]; //Another string?!
unsigned long wait; //Currently unused
byte type = TYPE_ERROR; //The code type to send
IRsend IR; //IR object
void setup()
{
Serial.begin(115200); //Serial
/* add setup code here */
}
void loop()
{
if (Serial.available())
{
buf = Serial.read();
if (buf == '>')
{
inputBuffer.toCharArray(inputStr, 30);
Serial << "inputBuffer = " << inputBuffer << endl;
Serial << "inputStr = " << inputStr << endl;
inputBuffer = "";
if (sscanf(inputStr, "%s %lu", &outputType, &wait) == 2)
{
Serial << "outputType = " << outputType << " wait = " << wait << endl;
if (!strcmp(outputType, "NEC"))
{
Serial << "Preparing to send a NEC IR code" << endl;
type = TYPE_NEC;
}
else if (!strcmp(outputType, "LG"))
{
Serial << "Preparing to send a LG IR code" << endl;
type = TYPE_LG;
}
else if (!strcmp(outputType, "PRONTO"))
{
Serial << "Preparing to send a PRONTO HEX code" << endl;
type = TYPE_PRONTO;
}
}
else
{
Serial << "Error." << endl;
return;
}
}
else if (buf == ';')
{
unsigned long HEXCode = 0;
inputBuffer.toCharArray(inputStr, 30);
Serial << "inputBuffer = " << inputBuffer << endl;
Serial << "inputStr = " << inputStr << endl;
inputBuffer = "";
if (type == TYPE_ERROR)
{
Serial << "Error in type string, aborting" << endl;
return;
}
else if (type == TYPE_NEC)
{
if (sscanf(inputStr, "%lx", &HEXCode))
{
IR.sendNEC(HEXCode, 32);
Serial << "Sent " << HEXCode << " in NEC format." << endl;
}
else
{
Serial << "Error: " << inputStr << " not valid." << endl;
}
}
else if (type == TYPE_LG)
{
if (sscanf(inputStr, "%lx", &HEXCode))
{
IR.sendLG(HEXCode, 32);
Serial << "Sent " << HEXCode << " in LG format." << endl;
}
else
{
Serial << "Error: " << inputStr << " not valid." << endl;
}
}
else if (type == TYPE_PRONTO)
{
IR.sendPronto(inputStr, false, false);
Serial << "Sent a code that is too long to fit here in PRONTO format." << endl;
}
else
{
Serial << "Error in type string, aborting" << endl;
return;
}
}
else //Build the string buffer
{
inputBuffer += buf;
}
}
/* add main program code here */
}