For hours, use long flashes, starting at 12 on the clock face and then another long flash for each 3 hours as you move around the clock. Then for the remaining hours give a short flash each.
For minutes, use long flashes, starting at 12 on the clock and then for each 15 min another long flash as you move around the clock . Short flashes add 5min to the total.
Make the long flashes for hours slightly longer than the minute flashes and leave a pause after each completed cycle.
Thus:
Daah.... Dah...., ..... == 12:00
Daah, Daah, Dit.... Dah, Dit...., .... == 4:05
Daah, Daah, Daah.... Dah, Dah, Dah, Dit...., .... == 6:35
Image below shows 10:30
Below is the code I used. Improve it, change it, play with it.
#include <stdio.h>
#include <DS1302.h>
namespace {
//DS1302 pins
const int kCePin = 5; // Chip Enable
const int kIoPin = 6; // Input/Output
const int kSclkPin = 7; // Serial Clock
const int ledPin = 9;
// this delay can be used to make the led
// flashes proportionately longer or shorter
const int shortdelay(40);
}
void setup() {
Serial.begin(9600);
rtc.writeProtect(false);
rtc.halt(false);
// Make a new time object to set the date and time.
//some code removed that sets time see https://github.com/msparks/arduino-ds1302/tree/master/examples/set_clock
Time t(2016, 7, 25, 19, 43, 50, Time::kMonday);
// Set the time and date on the chip.
//rtc.time(t);
pinMode(ledPin, OUTPUT);
}
void loop() {
Time t = rtc.time();
int hours = t.hr;
int munutes = t.min;
if(hours>12){
hours = hours-12;
}
int quarteroftwelves = hours/3;
int remhours = hours%3;
//Serial.println(quarteroftwelves);
blinkled(quarteroftwelves,15,4,4,1);
//Serial.println(remhours);
blinkled(remhours,1,6,15,0);
int quarterofsixty = munutes/15;
int remminutes = munutes%15;
int numoffivemunites = remminutes/5;
//Serial.println(quarterofsixty);
blinkled(quarterofsixty,9,4,4,1);
//Serial.println(numoffivemunites);
blinkled(numoffivemunites,1,6,45,0);
// Serial.println();
}
// count - number of times to blink
// ontime - length of time led stays on
// offtime - length of time led stays off between blinks
// belay - time to delay after blink cycle
// countfrom12 set to true for long dashes (adds one more flash to cycle to
// indicate start.
void blinkled(int count,int ontime, int offtime, int delaytime, bool countfrom12){
//added so long dashes start counting from 12
if(countfrom12){
digitalWrite(ledPin, HIGH);
delay(shortdelay*ontime);
digitalWrite(ledPin,LOW);
delay(shortdelay*offtime);
}
for(int i=0; i<count;i++){
digitalWrite(ledPin, HIGH);
delay(shortdelay*ontime);
digitalWrite(ledPin,LOW);
delay(shortdelay*offtime);
}
delay(shortdelay*delaytime);
}
Next step is to mount this onto the back of a little solar panel with a battery and have a simple "always-on" clock that can be read from a distance, even without glasses :-p