Go Down

Topic: Reg. #'s to hex #'s??? (Read 588 times) previous topic - next topic


I recently bought an LCD screen from Sparkfun, as well as a joystick kit. I want to interface the two to make a simple game system. The problem is, the LCD uses hex code and the joystick uses ordinary numbers. Does anyone have a bit of code (in the Arduino language) that would convert the regular numbers into hex numbers?


Numbers are numbers, until you need to convert them to some external format.  And I doubt whether either the LCD or the joystick you have actually uses one of those external formats that would require conversion...

It's surprising how often is this misunderstood.  I ran across some code recently (at a software megacorp that prides itself on hiring from the top 10%) that did:
Code: [Select]
sprintf(buf, "%d", var);
var2 = atoi(buf);
because "[var] is not actually a decimal number; it's part of an octet string."  Grr.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131