Vote count:
0
I have a string (or cstring) consisted of 24 bits "000101011110011110101110" that should be converted to hex (0x15e7ae).
As i understand bit string needs to be splitted on to 6 parts by 4 bits "0001 0101 1110 0111 1010 1110" and then each part converted to hex
0001 -> 1
0101 -> 5
1110 -> e
0111 -> 7
1010 -> a
1110 -> e
So what are the simplest and cost effective ways to convert it to hex representation: 0x15e7ae?
There is also dilemma for me which string type is better to use String or char[]. String can be easily splitted using substring function, but i don't know how to convert string type to hex.
And contrariwise char[] can be easily converted to hex using strtoul function but i didn't find simple way to split char string.
asked 20 secs ago
Best practice to convert bit string to hex (Arduino)
Aucun commentaire:
Enregistrer un commentaire