I need to send a bitstream to a Arduino with rs232 ,the bitstream has to be converted in to Hex nybbles and send as a hex character/
the bitstream looks like this 0,0,0,1,1 etc as a I8 array.
I have to send a string with characters T1A followed by the Bitstream in Hex terminated with a X.
How can i convert the bitstream to Hex characters?
Anyhelp is deeply appreciated,
Solved! Go to Solution.
Any particular reason the bitstream is an I8 array instead of a boolean array?
If you were working with booleans, you could Boolean to Number and be done.
With the I8, you'll have to do some bitwise manipulation.
Brute force would be to loop through and use shifts and ORs to pack your 8-bit hex number.
As a quick thought, you could loop through your I8 and use a selector to build an array of Booleans. Then use the Boolean Array to Number function on the array of Booleans. This seems a bit Rube Goldbergish though.
Solved it, made U8 to Boolean array in a loop ,had to reverse the bit order.