mattcuk / IRtranslator

Arduino IR Translator. Converts incoming IR codes from one manufacturer to another set of IR codes from a different manufacturer,
Creative Commons Zero v1.0 Universal
61 stars 5 forks source link

Compilation error: no matching function for call to 'IRsend::sendRaw(unsigned int [1], unsigned int, int)' #4

Closed TheFloW101 closed 7 months ago

TheFloW101 commented 8 months ago

Hi there, I want to send a 16bits IR signal, to my cleaning roboter (Tesvor500) to start cleaning, because I can´t get this machine in WLAN anymore. So I use a ESP32 D1 Mini to send a IR-signal. I read out my IR-Remote Control for the Tesvor500:

Protocol=PulseDistance Repeat gap=19500us Raw-Data=0x69BB 16 bits LSB first

I get a code like this from Chat-GPT:

#include <IRremote.h>
int IR_LED_PIN = 5;
IRsend irsend(IR_LED_PIN);

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  unsigned int rawData[] = {0x69BB};
  irsend.sendRaw(rawData, sizeof(rawData) / sizeof(rawData[0]), 19500);
  delay(1000);
}

But I got an error like this.... Compilation error: no matching function for call to 'IRsend::sendRaw(unsigned int [1], unsigned int, int)'

C:\Users\micro\AppData\Local\Temp.arduinoIDE-unsaved202409-4092-1c0n6es.nd3d\sketch_jan9a\sketch_jan9a.ino: In function 'void loop()': C:\Users\micro\AppData\Local\Temp.arduinoIDE-unsaved202409-4092-1c0n6es.nd3d\sketch_jan9a\sketch_jan9a.ino:15:70: error: no matching function for call to 'IRsend::sendRaw(unsigned int [1], unsigned int, int)' irsend.sendRaw(rawData, sizeof(rawData) / sizeof(rawData[0]), 19500); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:285, from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.h:10, from C:\Users\micro\AppData\Local\Temp.arduinoIDE-unsaved202409-4092-1c0n6es.nd3d\sketch_jan9a\sketch_jan9a.ino:1: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:435:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast16_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:435:6: note: no known conversion for argument 1 from 'unsigned int [1]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:414:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast16_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:414:6: note: no known conversion for argument 1 from 'unsigned int [1]' to 'const uint16_t' {aka 'const short unsigned int'}

exit status 1

Compilation error: no matching function for call to 'IRsend::sendRaw(unsigned int [1], unsigned int, int)'

I am a newbie to program with Arduino. Could someone help me to start my cleaning-roboter with IR-Signal?

Thanx! :)

mattcuk commented 8 months ago

Were you able to successfully compile the code I provided (rather than what ChatGPT created)?

TheFloW101 commented 8 months ago

Thank you for your answer. I'll check it the next free time and give a Feedback

TheFloW101 commented 7 months ago

Hey mattcuk, by verifying the code I got this error...

C:\Users\micro\Downloads\irtranslator\irtranslator.ino: In function 'void loop()': C:\Users\micro\Downloads\irtranslator\irtranslator.ino:65:68: error: no matching function for call to 'IRsend::sendRaw(unsigned int [67], unsigned int, int)' IrSender.sendRaw(rawData, sizeof(rawData)/sizeof(int), 38); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:222, from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.h:10, from C:\Users\micro\Downloads\irtranslator\irtranslator.ino:8: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint16_t' {aka 'const short unsigned int'} C:\Users\micro\Downloads\irtranslator\irtranslator.ino:75:72: error: no matching function for call to 'IRsend::sendRaw(unsigned int [67], unsigned int, int)' IrSender.sendRaw(rawData, sizeof(rawData)/sizeof(int), 38); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:222, from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.h:10, from C:\Users\micro\Downloads\irtranslator\irtranslator.ino:8: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint16_t' {aka 'const short unsigned int'} C:\Users\micro\Downloads\irtranslator\irtranslator.ino:82:72: error: no matching function for call to 'IRsend::sendRaw(unsigned int [67], unsigned int, int)' IrSender.sendRaw(rawData, sizeof(rawData)/sizeof(int), 38); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:222, from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.h:10, from C:\Users\micro\Downloads\irtranslator\irtranslator.ino:8: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint16_t' {aka 'const short unsigned int'} C:\Users\micro\Downloads\irtranslator\irtranslator.ino:89:72: error: no matching function for call to 'IRsend::sendRaw(unsigned int [67], unsigned int, int)' IrSender.sendRaw(rawData, sizeof(rawData)/sizeof(int), 38); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:222, from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.h:10, from C:\Users\micro\Downloads\irtranslator\irtranslator.ino:8: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint16_t' {aka 'const short unsigned int'} C:\Users\micro\Downloads\irtranslator\irtranslator.ino:96:72: error: no matching function for call to 'IRsend::sendRaw(unsigned int [67], unsigned int, int)' IrSender.sendRaw(rawData, sizeof(rawData)/sizeof(int), 38); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:222, from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.h:10, from C:\Users\micro\Downloads\irtranslator\irtranslator.ino:8: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint16_t' {aka 'const short unsigned int'} C:\Users\micro\Downloads\irtranslator\irtranslator.ino:116:68: error: no matching function for call to 'IRsend::sendRaw(unsigned int [67], unsigned int, int)' IrSender.sendRaw(rawData, sizeof(rawData)/sizeof(int), 38); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:222, from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.h:10, from C:\Users\micro\Downloads\irtranslator\irtranslator.ino:8: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:248:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast8_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast8_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:225:6: note: no known conversion for argument 1 from 'unsigned int [67]' to 'const uint16_t' {aka 'const short unsigned int'}

exit status 1

Compilation error: no matching function for call to 'IRsend::sendRaw(unsigned int [67], unsigned int, int)'

I installed the V3.5.2 of IRemote library. Now I try the V3.0.0 of IRemote library. Same error. :(

Wat hcan I do?

mattcuk commented 7 months ago

Hmm, instead of your code here;

void loop()
{
   unsigned int rawData[] = {0x69BB};
   irsend.sendRaw(rawData, sizeof(rawData) / sizeof(rawData[0]), 19500);
   delay(1000);
}

Try

void loop()
{
   unsigned int rawData[] = { 27067 };
   irsend.sendRaw(rawData, sizeof(rawData) / sizeof(int), 19500);
   delay(1000);
}

That just makes it match what I have in the sample code I provided.

If that doesn't work, copy & paste my sample code over the top of yours & make sure that compiles.. then you have something to work from that you know is ok.

TheFloW101 commented 7 months ago

Hey, I'll test it on weekend. Thank You!

TheFloW101 commented 7 months ago

Hey Mattcuk, again unfortunately with an error message. I am desperate 🙁. is it so difficult to send the required signal via IR? unfortunately I am so inexperienced in C+ programming that I cannot understand the code and the error messages. I am more at home with basic programming. I started with C64 back then. and currently I do a lot of work in excel in VBA. there I understand better what the code does. isn't there anyone who can write a code for the code read in via IR-receiver that can send this code out again via IR-transmitter and get my robot vacuum cleaner to start?

C:\Users\micro\OneDrive\Dokumente\Arduino\sketch_jan9a\sketch_jan9a.ino: In function 'void loop()': C:\Users\micro\OneDrive\Dokumente\Arduino\sketch_jan9a\sketch_jan9a.ino:15:64: error: no matching function for call to 'IRsend::sendRaw(unsigned int [1], unsigned int, int)' irsend.sendRaw(rawData, sizeof(rawData) / sizeof(int), 19500); ^ In file included from c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRremote.hpp:285, from C:\Users\micro\OneDrive\Dokumente\Arduino\sketch_jan9a\sketch_jan9a.ino:1: c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:435:6: note: candidate: 'void IRsend::sendRaw(const uint8_t, uint_fast16_t, uint_fast8_t)' void IRsend::sendRaw(const uint8_t aBufferWithTicks[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:435:6: note: no known conversion for argument 1 from 'unsigned int [1]' to 'const uint8_t' {aka 'const unsigned char'} c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:414:6: note: candidate: 'void IRsend::sendRaw(const uint16_t, uint_fast16_t, uint_fast8_t)' void IRsend::sendRaw(const uint16_t aBufferWithMicroseconds[], uint_fast16_t aLengthOfBuffer, uint_fast8_t aIRFrequencyKilohertz) { ^~ c:\Users\micro\OneDrive\Dokumente\Arduino\libraries\IRremote\src/IRSend.hpp:414:6: note: no known conversion for argument 1 from 'unsigned int [1]' to 'const uint16_t' {aka 'const short unsigned int'}

exit status 1

Compilation error: no matching function for call to 'IRsend::sendRaw(unsigned int [1], unsigned int, int)'

I'll try Phython code too with no solutions. 🙁

mattcuk commented 7 months ago

Have you tried copy & pasting my sample code over the top of yours & make sure that compiles.. then you have something to work from that you know is ok.

TheFloW101 commented 7 months ago

Hey, yes. I copied it and got this, what I wrote yesterday. But I found something else on Youtube...

https://dronebotworkshop.com/ir-remotes/

I'm still trying it out. I'll let you know when I've achieved results. But that will probably not be until next weekend.

Thank You to Look after me... 😉 ... Have a nice Day.

TheFloW101 commented 7 months ago

Hey mattcuk, I have finally found a solution. I have modified the following code from the workshop mentioned above for my purposes...

 /* FloW 27.01.2024

 * Specify DistanceWidthProtocol for decoding. This must be done before the #include <IRremote.hpp>
 */
#define DECODE_DISTANCE_WIDTH // Universal decoder for pulse distance width protocols
//
#if !defined(RAW_BUFFER_LENGTH)
#  if RAMEND <= 0x4FF || RAMSIZE < 0x4FF
#define RAW_BUFFER_LENGTH  120
#  elif RAMEND <= 0xAFF || RAMSIZE < 0xAFF // 0xAFF for LEONARDO
#define RAW_BUFFER_LENGTH  400 // 600 is too much here, because we have additional uint8_t rawCode[RAW_BUFFER_LENGTH];
#  else
#define RAW_BUFFER_LENGTH  750
#  endif
#endif

#include <IRremote.hpp>

/// Storage for the recorded code, pre-filled with data
IRRawDataType sDecodedRawDataArray[RAW_DATA_ARRAY_SIZE] = { 0x69BB }; // address command to send
DistanceWidthTimingInfoStruct sDistanceWidthTimingInfo = { 3000, 2950, 550, 1650, 550, 550 }; // timing
uint8_t sNumberOfBits = 16;

void setup() {
  Serial.begin(115200);
  IrSender.begin(5); // Set the IR LED pin to 5

//}

// void loop() {
        Serial.print(F("Send commands to Tesvor"));
        //Serial.print(sNumberOfBits);
        //Serial.print(F(" bits 0x"));
        //Serial.print(sDecodedRawDataArray[0], HEX);
        //Serial.print(F(" with sendPulseDistanceWidthFromArray timing="));
        //IrReceiver.printDistanceWidthTimingInfo(&Serial, &sDistanceWidthTimingInfo);
        //Serial.println();
        Serial.flush(); // To avoid disturbing the software PWM generation by serial output interrupts

       // sending command to wake up
        IrSender.sendPulseDistanceWidthFromArray(38, &sDistanceWidthTimingInfo, &sDecodedRawDataArray[0], sNumberOfBits,PROTOCOL_IS_LSB_FIRST, 100, 0);

  // wait
  delay(5000); // waiting 5 sec to start cleaner

  IrSender.sendPulseDistanceWidthFromArray(38, &sDistanceWidthTimingInfo, &sDecodedRawDataArray[0], sNumberOfBits,PROTOCOL_IS_LSB_FIRST, 100, 0);

  // wait
  delay(2000); // waiting 2 sec to send second command

IRRawDataType sDecodedRawDataArray[RAW_DATA_ARRAY_SIZE] = { 0xF0BB };
        IrSender.sendPulseDistanceWidthFromArray(38, &sDistanceWidthTimingInfo, &sDecodedRawDataArray[0], sNumberOfBits,PROTOCOL_IS_LSB_FIRST, 100, 0);

}

void loop() {
  // leave empty to avoid generating a loop and to end the code
}

I also realized that the range of the IR transmitter is very short, so I have to be quite close to the device to send the code. But basically it doesn't matter, it gets me to my destination. Now I'll see how the code can be simplified.

Thank you so far for your interest and help, I really appreciate it.

Greetings FloW

mattcuk commented 7 months ago

Brilliant; I'm so glad you figured it out! Happy robot vacuuming! :)