My current project entails sending bytes over the air from one arduino to another by way of XBee API.
Take for example I wish to send the decimal numbers, 127, 57, and 90.
My transmission turns that into a HEX byte when it sends across 2 xbees. And lands on a second arduino. Stored as a byte.
byte pixel[] = {0x7F, 0x39, 0x5A}
I then plug in this info to a command string. with integers.
strip.setPixelColor(1, pixelcell[2], pixelcell[1], pixelcell[0]) ;
Which would be all well and good, but the setPixelColor string need decimals. If you send it as is, it uses a HEX counting range. EX : 08 to 09 to 0A, 0B, 0C, 0D, 0E, 0F, 10, 11.
This screws up the setPixelColor, since it is not expecting to see HEX characters. It wants decimal numbers.
I need it to convert the HEX to decimal when it fills in those spaces. It should progress as: 08,09,10,11,12,13
Now in a normal Serial.println. You can easily convert a number to a decimal by simply adding DEC to the end.
Example:
Serial.println(pixelcell[1], DEC); and you would get: 57.
How can I do this when it is not printing to Serial in ascii form?
I have tried wrapping it in a char() but that still outputs as a HEX. Example: char(pixelcell[2]) = 7F.
Do you have a suggestion on how I could address this problem?