I'm trying to figure out the bit rate of an attached serial device. I've configured the device to send binary data at a rate of 10Hz. My plan was to look at one message from the device, count the number of bits, and then multiply by 10 to get bps.
Here is an example of how I count bits in python, using a fragment of one message:
>> message = "\0xdf\0xd0sA_\0xff0D\0x02\0xef0B"
>> 8 * sys.getsizeof(message)
512
And finally my question: should I be counting the hex prefixes "\0x" ? Maybe I should convert the message to a binary representation and then see how long it is?