Pages: [1]   Go Down
Author Topic: Reg. #'s to hex #'s???  (Read 360 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

SF Bay Area (USA)
Offline Offline
Tesla Member
Karma: 135
Posts: 6782
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
sprintf(buf, "%d", var);
var2 = atoi(buf);
because "[var] is not actually a decimal number; it's part of an octet string."  Grr.

Pages: [1]   Go Up
Jump to: