Error Compiling to use IR Remote

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
juancollazo
 
Posts: 1
Joined: Mon Mar 27, 2017 2:32 pm

Error Compiling to use IR Remote

Post by juancollazo »

The remote didn't work with the default code so I decided to uncomment the "Serial.println(results.value, HEX)" to debug and update the HEX codes for each function but it doesn't want to compile. Below I have included the error message, any suggestions ?


Arduino: 1.8.1 (Mac OS X), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 115200, 4M (3M SPIFFS)"

/Users/Juan/Documents/Arduino/Adabox004_IR/Adabox004_IR.ino: In function 'void loop()':
Adabox004_IR:70: error: call of overloaded 'println(uint64_t&, int)' is ambiguous
Serial.println(results.value, HEX);
^
call of overloaded 'println(uint64_t&, int)' is ambiguous

User avatar
cemclellan
 
Posts: 22
Joined: Fri Aug 21, 2009 10:50 am

Re: Error Compiling to use IR Remote

Post by cemclellan »

I ran into a similar issue. I am not expert enough to explain the error code in detail, but basically the number returned from the IR remote is a 64 bit number, which is too large for the Serial.println() function.

What I did was to try to break out the lower byte from the 64 bit number, By doing this I was able to infer the codes returned from the remote. The code I used is here:

I put this definition near the top of the file:

byte keyCodeLSB; //Least Significant byte of key code from remote (command)

Then in place of the line you un-commented i did this:

// This code is used to understand remote key presses
keyCodeLSB = byte(results.value);
Serial.print("\nThe Key Code LSB is: ");
Serial.println(keyCodeLSB, HEX);

I posted the code I used to play tracks 0 - 9 in the post - viewtopic.php?f=59&t=119535

I have attached a file with the IR remote keycodes.
Attachments
MiniRemote_NEC_Codes.pdf
(22.23 KiB) Downloaded 71 times

User avatar
hyp3rMC
 
Posts: 30
Joined: Wed Mar 15, 2017 6:51 pm

Re: Error Compiling to use IR Remote

Post by hyp3rMC »

Thank you very much @cemclellan! I have run into the same issue and used the codes that you have posted here and it works!
Thank you also for posting the codes. It help speed things up as I'm still learning. Can I just ask how can one decipher hex code to use in this program? for example:

Code: Select all

The Key Code LSB is: D7
playing track #4

The Key Code LSB is: FF
but on the NEC codes in the pdf it has that 32 bit hex... button 4 = 0x00FD28D7
I'm hoping to understand more and learn to convert to 32 bit hex...
Again, I appreciate the help and for sharing the solution.
Happy 4th everyone!

User avatar
cemclellan
 
Posts: 22
Joined: Fri Aug 21, 2009 10:50 am

Re: Error Compiling to use IR Remote

Post by cemclellan »

There is a note on the last page of the PDF I posted.

The lower 2 bytes of the code are the command,
The next 2 bytes are the inverse (logical not) of the command (presumably for error detection),
The next 4 bytes are the address, in this case fixed to 0xFD.

I learned this by searching for NEC codes (use DuckDuckGo for internet searches, not Google).
For button 4, my code reported the last 2 bytes as - D7
The inverse is 28.

Putting it all together you get 0x00FD28D7..

The leading zeros don't matter in the test.

I used the code I posted, along with this information to create the table I posted.

User avatar
hyp3rMC
 
Posts: 30
Joined: Wed Mar 15, 2017 6:51 pm

Re: Error Compiling to use IR Remote

Post by hyp3rMC »

Thank you again! This really has been helpful...

User avatar
daniellet
 
Posts: 1
Joined: Sun Sep 17, 2017 5:19 pm

Re: Error Compiling to use IR Remote

Post by daniellet »

Hey, I was messing around with this problem too (trying to tweak the code for more functionality).

Looks like you can also do this:

Code: Select all

Serial.print("\nThe Value is: 0x");
Serial.println((int)(results.value), HEX);
And it seems to print the correct value

User avatar
cemclellan
 
Posts: 22
Joined: Fri Aug 21, 2009 10:50 am

Re: Error Compiling to use IR Remote

Post by cemclellan »

Danielle,

Thanks for posting this!

Your method of printing out the key values from the remote is much nicer than the approach I used!

Locked
Please be positive and constructive with your questions and comments.

Return to “AdaBox! Show us what you made!”