| Specifying Data | Index |
Data is transferred as raw bytes. The Console program converts the text entered by the user into the appropriate raw bytes and sends them as packets to BrainStem modules. When receiving data, the Console converts incoming raw bytes to hexadecimal text. The Console program understands several different formats for specifying byte values. These formats can be mixed when entering the data for a command or packet .
Binary Numbers
Binary numbers are all preceeded by a "0b", followed by characters 1 or 0 to represent the individual bits in the value. Here are some binary number examples followed by their decimal equivalents:
0b101 = 5
0b10101010 = 170
0b01 = 1
Decimal Numbers
Decimal numbers are specified simply:
4
-100
255
Hexadecimal Numbers
Hexadecimal numbers are all preceeded by a "0x", followed by characters 0-9 and A-F to represent the digits in the value. The digits A-F represent hexadecimal digits 10-15. Here are some examples:
0x40 = 64
0x0 = 0
0xAA = 170
Strings
Strings are just a series of bytes that have ASCII codes. Here are some examples:
"ABC" = 0x41, 0x42, 0x43
"123" = 0x31, 0x32, 0x33
Related: