Convert 6 digit hex values to 10bit rgb

I would like to send 6 digit hex values as ASCI strings over serial, and have the Arduino convert this to 10bit RGB for use with Shiftbrites etc.

So FFFFFF would be converted to 1023,1023,1023.

How is this done? any info or links to a good tutorial would be great. thanks!

So FFFFFF would be converted to 1023,1023,1023.

FF = 255. FF = 255. FF = 255.
Why are you trying to stretch 255 to 1023?

Why are you trying to stretch 255 to 1023?

Because the LED Driver takes values 0 - 1023 for each channel.

My computer application will output FFFFFF for white, therefore I need to convert it.
colour = FFFFFF
r = 255, g = 255, b = 255.
r = 1023, g = 1023, b = 1023.

and for any other hex value.

Is there a function that converts an ASCII hex value to numeric?

Because the LED Driver takes values 0 - 1023 for each channel.

That being the case, why does

My computer application will output FFFFFF

Your computer application should output values that match the LED driver.

Otherwise, you might just as well multiply the values by 4. You'll simply increase the granularity between adjacent values.

Is there a function that converts an ASCII hex value to numeric?

strtoul().

strtoul().

great thanks.

Your computer application should output values that match the LED driver.

The main reason is that I can send all the values in one packet if they are 6 digit hex values, and also I don't really need that much colour resolution.

The main reason is that I can send all the values in one packet if they are 6 digit hex values

Sending 3 bytes worth of data in 6 characters is not more efficient than sending 3 ints worth of data in 6 bytes.

The FFFFFF pattern may look like it means something to you. Sending 1023 as 2 bytes, three times, means just as much to the Arduino, and requires no strtoul() conversion on the receiving end. Just some bit shifting, which is way faster.

Sending 3 bytes is even faster and even simpler to decode, just shift the 3 bytes by 2 to get your 10 bit range. You don't have more granularity anyway.

Sending 3 bytes worth of data in 6 characters is not more efficient than sending 3 ints worth of data in 6 bytes.

ahh yes, because I was also dealing with text elements I got it stuck in my head that every character was a byte.

Sending 3 bytes is even faster and even simpler to decode, just shift the 3 bytes by 2 to get your 10 bit range. You don't have more granularity anyway.

Do you mean simply like this:
255<<2 = 1020?

Yes.