Digital clock with temp

This is a special forum devoted to educators using Adafruit and Arduino products for teaching.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Digital clock with temp

Post by adafruit_support_bill »

The library does support printing of floating point numbers. You should not have to convert it to a string.

Code: Select all

void  Adafruit_7segment::print(double n, int digits)
{
  printFloat(n, digits);
}
I think the problem is the second parameter you are passing is "DEC", where the library is expecting the number of significant digits. The definition of DEC is:

Code: Select all

#define DEC 10
So it is probably trying to print 10 digits on a 4 digit display.

User avatar
curtisd
 
Posts: 24
Joined: Fri Mar 21, 2014 10:41 am

Re: Digital clock with temp

Post by curtisd »

Thank you, It worked now. I changed the clockDisplay.print(Fahrenheit,DEC); to clockDisplay.print(fahrenheit);. Thank you. I will cleanup my code and take pictures of the Bread Board and post. What is the best way to post? I will try to make the temperature precision to the tenth's place and put a "C" or "F" . Curtis

User avatar
adafruit_support_bill
 
Posts: 88154
Joined: Sat Feb 07, 2009 10:11 am

Re: Digital clock with temp

Post by adafruit_support_bill »

Glad that is working for you now. There is a 1 meg limit on uploads. It generally works best if you resize photos to about 800x600.

Locked
Please be positive and constructive with your questions and comments.

Return to “For Educators”