convert HEX (ASCII) to a DEC int


hi,

i on arduino serial string "cc", , need convert int decimal value of 0xcc (that 204).

i found in forum, topics convert long-long values (convert big string hex value, big decimal value), or hex representation of ascii character (like 'c' = 0x43) , isn't want.

knows function simple conversion ("cc -> 204)?

code: [select]
hexdigit = toupper(hexdigit);
digit = (hexdigit >= 'a') ? hexdigit - 'a' + 10 : hexdigit - '0';

"toupper", range checking , double digit conversion left exercise reader.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > convert HEX (ASCII) to a DEC int


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums