Data Conversion Issue

First post here, a bit confused about a data conversion task, with an IR remote test and using IRremote library.

I setup an IR receiver and checked the IR codes from an LG remote. The IR codes are the same as the ones listed here -> LG remote infrared codes ($1690600) · Snippets · Snippets · GitLab. Someone in that thread also posted the equivalent 9 digit decimal codes.

So then I setup an IR transmitter and was trying to start my LG tv up using irsend.sendLG(). I think it was saying that was deprecated and recommended to use irsend.sendLGRaw() instead.

Question is how do I convert those values to unisigned int for this?
Assuming the spec is below(?) do I need to pass 4 parameters? Or are some optional?
It doesn't sound difficult but heck I'm confused!

https://arduino-irremote.github.io/Arduino-IRremote/ir__LG_8cpp_source.html#l00117

Thanks.

Welcome to the forum

If the values that you are referring to are these

1->20DF8877
2->20DF48B7
3->20DFC837
4->20DF28D7
5->20DFA857
etc

Then you can use them as an integer by using this format 0x20DF18E7, but the value will not fit into an unsigned int , an unsigned long will be needed

void setup()
{
  Serial.begin(115200);
  while (!Serial);
  Serial.println(0x20DF8877);
  Serial.println(sizeof(0x20DF8877));
}

void loop()
{
}

Thanks. Yes I was talking about the "IR Codes"

1->20DF8877
2->20DF48B7
3->20DFC837
4->20DF28D7
5->20DFA857

But also there is a list of decimals:

1->551520375
2->551504055
3->551536695
4->551495895
5->551528535

To pass into -->

void IRsend::sendLGRaw(uint32_t aRawData, uint_fast8_t aNumberOfRepeats, bool aIsRepeat, bool aUseLG2Protocol)

The decimal codes are already integers and will fit in a 32 bit variable such as an unsigned long (also known as a uint32_t)

As you can see, the sendLGRaw() function takes 4 parameters, some of which may be optional, but you can, of course, supply your own values.

I am guessing but

  • aRawData is the raw data, the integer values for which you have (as above)
  • aNumberOfRepeats is possibly the number of times to send the repeat code if the keypress is to be repeated if held down. It is an 8 bit value
  • aIsRepeat is a boolean (true/false) value indicating that the value sent can repeat if the key is held down or not
  • aUseLG2Protocol is a boolean (true/false) value indicating that the LG2 Protocol should be used or not

As I said, I am guessing

Thanks will give it a shot, after I get a new IR transmitter. In the meantime...

Why not create a new Libraries tab at the top. So that developers can publish their Library info to this one central place. And include a drop down to select the Library version for the API Spec. The library API Spec should have a consistent layout similar to the concept of Javadoc. So anyone can clearly read the Spec, all functions and parameters etc and the comments? For example the function argument comments and what fields are mandatory etc. Would be a great idea I think!