Hello ,
I am currently working on ARDUINO uno with RTC and the RTC data display on TFT.
I have done everything regarding to RTC using the RTClib.h and wire.h in 12 hour format but still not set the Am pm format on it.
I started the RTC in 12 hour mode like these,
DD = now.day();
MM = now.month();
YY = now.year();
H = now.hour()%12; ///the 12 hour format
M = now.minute();
S = now.second();
It work fine but, how can i call the Am & Pm in accordance with time update?
where I will change to get the Am PM pattern and how I call it for TFT print?
pylon
2
It work fine but, how can i call the Am & Pm in accordance with time update?
By changing the sketch accordingly. We cannot help because you're keeping the sketch, the wiring and all information about the hardware secret.
where I will change to get the Am PM pattern and how I call it for TFT print?
If that snippet above is your actual code, you get the flag
bool pm = now.hour() / 12;
1 Like
sorry pylon for late reply ,
but I managed to get the same structure from 24 hours,like these
if (now.hour() > 12 )
{
H = now.hour() - 12;
}
else
{
H = now.hour();
}
if (now.hour()>= 12 )
{
tft.setCursor(440, 300);
tft.println("Pm");
}
else
{
tft.setCursor(440, 300);
tft.println("Am");
}
so thanks for your teply..
1 Like