How to convert the number of c++?

Hello. Became interested in programming the MC, but the language still can't log in.
WS2812FX a library that implements some of the current data, in particular for obtaining the current color:
uint32_t WS2812FX::getColor(void) {
 return _segments[0].colors[0];
}

And also the installation of color:
void WS2812FX::setColor(uint32_t c) {
RESET_RUNTIME;
 _segments[0].colors[0] = c;
setBrightness(_brightness);
}

In the sketch the color is set as:
uint32_t tmp = (uint32_t) strtol(&server.arg(i)[0], NULL, 16);
if(tmp >= 0x000000 && tmp <= 0xFFFFFF) {
ws2812fx.setColor(tmp);
}

That is, in the server.arg(i)[0] comes the HTML color in FF0000
My catch:
Get the current color ws2812fx.getColor() and give it to http, but comes already value is quite different: to set white color (FFFFFF) comes the number 16777215 is obtained the maximum number of unsigned int and, for example, green (00FF00) is the number 65280

In General, the question: How to me from this number to paying HTML color code?
June 7th 19 at 14:41
1 answer
June 7th 19 at 14:43
Solution
0xFFFFFF is a hexadecimal representation of the decimal number 16777215
as 0xFF00 equal to 65280 in decimal.

Even the Windows calculator in "programmer" has a feature of converting number systems
5a99be29be4bf244944246.png

C print the number in HEX form using printf("%X", number)
Thank you very much! Only now another problem. Translated 65280 - the output is FF00... And I 00FF00 - Jack commented on June 7th 19 at 14:46
so there is the usual number. zeros in front you can add, the value will not change. in C to add zeros when you print you can do
printf("%06X", number) - turner.Beahan commented on June 7th 19 at 14:49
Thank you! Did %06X helped) - Jack commented on June 7th 19 at 14:52

Find more questions by tags Arduino