Arduino-Hex-Decimal-Conversion icon indicating copy to clipboard operation
Arduino-Hex-Decimal-Conversion copied to clipboard

Negative values

Open maincraft-io opened this issue 4 years ago • 2 comments

This function isn't work for negative values. HEX (Positive) 0c 58 = okay > 3160 HEX (Negative) fa 62 = wrong

maincraft-io avatar Sep 27 '20 12:09 maincraft-io

For someone who need correct solution for Arduino 👍 Just use 1 line of my code instead this repository :)

void setup() { Serial.begin(9600); }

void loop() { signed int answer = strtol("YOUR HEX HERE", NULL, 16); Serial.println(answer); delay(1000); }

maincraft-io avatar Sep 27 '20 12:09 maincraft-io

Oh wow, I didn't realize that function existed. Thank you for posting this @maincraft-io

benrugg avatar Sep 27 '20 13:09 benrugg