The orientation is not so important, I plan to use the larger 128 x 64 display once they become available.
I am however having a problem with conversion. It's something basic, I know, but I'm not well versed in C/C++ so I need a little help.
In the following function, I need the 3rd parameter to be variable, based on a number from 0 to 1023, which will then be scaled to feet, inches, and fractions of an inch.
oled.drawstring(0, 0, "3' 1-1/2''");
So, for example, say 512 converts to an arbitrary distance of 3' 1-1/2", my conversion constant would be .07324219. I would then take the result (37.5) and divide by 12 (inches per foot). If there's a remaining decimal, I convert that to inches and fractions of an inch.
My question is how do I change the third parameter dynamically with a numeric value that, I assume would need to be converted to a string.
Thanks
SSD1306 Library
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: SSD1306 Library
the itoa() function can convert a number to a string and you can then draw that string using drawstring(), google around for more information on how to use itoa() - we don't have any example or tutorial code for it at this time.
https://www.google.com/search?q=itoa+arduino
https://www.google.com/search?q=itoa+arduino
Please be positive and constructive with your questions and comments.