Converting hex color code format

Hello,

I am trying to control some addressable LEDs using a web interface hosted by my ESP32. I am stuck on finding a way to convert the color code from HTML color input (ex. #123456) into a long int (ex. 0x123456) for the LEDs to accept. Any suggestions?

Thanks in advance.

What's the html code for.. Green?

-jim lee

Hi,

I just threw an example color code in there, so I'm not sure what color that is. The thing I'm having trouble with is converting the format the number is in.

Welcome,

You can use strtoul with base 16, or sscanf

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.