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)?
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
Post a Comment