Go Down

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

nerdboy64

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?

westfw

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