converting 2 byte hex numbers back to a demical
the code below, produces following output on serial console
[42][25][f][27][0][0].
my question - if had serial output - how figure out number 9999? how maths work? think has little endian?
code: [select]
int = 9999;
buf[0] = 'b';
buf[1] = '%';
buf[2] = a&0xff;
buf[3] = (a>>8)&0xff;
buf[4] = (a>>16)&0xff;
buf[5] = (a>>24)&0xff;
quote
the code below, produces following output on serial consoleno, doesn't.
ascii 'b' = 0x42
ascii '%' = 0x25
0x270f = 999910 when converted little endian big endian.
Arduino Forum > Using Arduino > Programming Questions > converting 2 byte hex numbers back to a demical
arduino
Comments
Post a Comment