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 console
no, 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

Popular posts from this blog

Help with Missing Filename Error?

Using phone battery to power a plane.

more info - Joomla! Forum - community, help and support