Hi,

In an arduino sketch I am using "ambilight_hyperion.ino" has the following instructions to calculate the character prefix:

// to calculate your prefix, the first 4 bytes will never change: const char prefix[] = {0x41, 0x64, 0x61, 0x00, this never changes.

// the next byte is equal to the number of LED - 1 --> (232-1)=231. 231 transformed in HEX. 231 in hex is E7 (use google)

// the last byte is equal to the XOR value of the calculated value just above and 0x55 (byte just calculated (E7) XORED with 0x55) = B2 use this link http://xor.pw/? and in input 1 put 55 and in input 2 put your HEX value.

// some precalculated values to save some time: 178 leds gives B1 and E4, 180 B3E6, 181 B4E1, 182 B5E0 232 E7B2 230 E5B0

In my system I have 264 LEDs and the character prefix output according to those calculations

is the following:

const char prefix[] = {0x41, 0x64, 0x61, 0x00, 0x107, 0x152};

This values will overflow the array. 0x107 and 0x152 are not valid values for this array type.

Can anyone help me finding out how to calculate the proper character prefixes for my setup. (264 leds)

My calculations were: 264 leds - 1 = 263 in decimal = converted to HEX 107

HEX 55 XOR HEX 107 = 152

I assume the HEX should be 2 digits to work on this array.

PS: Sketch is in attachment

Thank you for your time.

Ambilight_Hyperion.ino (9.96 KB)