Hy, this is my first post so, don't be hard on me. I'm a neewbie in arduino and i've make a clock/date & temperature "appliance" . The problem is on clock, the 01,02,03,04,05,06,07,08,09 minutes/seconds are displayed wrong (as you can see in the picture) and if the temperature is made of 1 digit ... well, you can see that too. Below is my code, and I don't know where i'm wrong ... Can you help me ?
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <UTFT.h>
#include "RTClib.h"
extern uint8_t SmallFont[];
extern uint8_t SixteenSegment[];
UTFT myGLCD(SSD1289, 38, 39, 40, 41);
RTC_DS1307 RTC;
#define ONE_WIRE_BUS 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void) {
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setColor(0, 255, 255);
// Start up the library
sensors.begin();
Serial.begin(9600);
Wire.begin();
RTC.begin();
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
// RTC.adjust(DateTime(__DATE__, __TIME__));
}
}
void loop(void) {
DateTime now = RTC.now();
int temp = (sensors.getTempCByIndex(0));
myGLCD.setFont(SmallFont);
sensors.requestTemperatures(); // Send the command to get temperatures
myGLCD.print("Digital Clock & Thermometer", CENTER, 10);
myGLCD.setFont(SixteenSegment);
myGLCD.printNumI(temp, CENTER, 50);
myGLCD.print("'C", 240, 50);
myGLCD.printNumI(now.year(), 200, 110);
myGLCD.print("/", 170, 110);
myGLCD.printNumI(now.month(), 120, 110);
myGLCD.print("/", 75, 110);
myGLCD.printNumI(now.day(), 15, 110);
myGLCD.printNumI(now.hour(), 35, 170);
myGLCD.print(":", 95, 170);
myGLCD.printNumI(now.minute(), 130, 170);
myGLCD.print(":", 190, 170);
myGLCD.printNumI(now.second(), 220, 170);
}