Hi,
My wife bought me a binary clock shield that fits onto an Arduino Uno for Christmas last year. The binary clock works great but it is in the 24Hr. format. I would like to have it display only 12Hr. format. I contacted the author and designer of the shield and back in January, he told me he would be able to convert the code to 12Hr. format in a couple weeks. After several more e-mails, promises of a couple weeks I still don't have the code for a 12Hr. format. I have spent hours trying to figure out how to convert it but I am not a programmer. Below is the link to the code on Github.
If anyone can help, I would really appreciate it.
Just a shot in the dark, but try to find and replace this function with this code:
void getAndDisplayTime()
{
// Read time from RTC
t = RTC.get();
// Convert time to binary format and display
int hours = hour(t);
if (hours > 12) hours -= 12;
convertDecToBinaryAndDisplay(second(t), minute(t), hours);
}
That will probably fix the display, but doesn't address user interface for setting time and alarms. Might also want to repurpose MSB LED of hours for AM/PM Indicator since only need 4 bits for that now. Will probably take several iterations to get it completely right.
Not sure whether I would do that in void convertDecToBinaryAndDisplay() or getAndDisplayTime(), but I suppose either could work for the display at least, but in the case of the latter you might want to pass the pm indicator to the former.
Thank you for the response. I added the code and it did convert to 12hr. Thank You. When I set the time, and scroll thru the hours at 12 o'clock, none of the LED light but then I scroll all thru the time (1,2,3...)and get back to 12 o'clock, the 12 is displayed. It displays every other 12 o'clock. Any ideas how to fix that. I am so happy that I don't have 24Hr. clock anymore. Thank you
Sounds like the midnight problem I mentioned. When you get to 23:59:59 on the 24hr clock it then rolls over to 00:00:00 so you won't get any LEDs light up. That's why I suggested an additional line to deal with that. Just add the following to johnwasser's example: