Hi Guys,
I'm currently building a traffic light clock for my little girl. The basic idea is simple: Red means stay in Bed, Orange means You may play but don't disturb your parents, and Green, well that's pretty much obvious.
To accomplish this, I make thankfull use of the TimeAlarms Library, which works perfectly.
However, I would like to make things a bit more usefull, by adding the option to configure the clock over the network. I have added an Ethernet shield, (time is also synced by NTP) and I receive a string from my webserver which contains information about the clocks configuration.
The string I receive looks something like this:
Red, 10,0,0~Green, 11,0,0~Orange, 12,0,0~Off, 13,0,0
Next step is to split the string by ~ and loop through all alarm instances. No problems there.
Finally, add an alarm instance for every item in the loop. This is where my problem is.
When I try to add an alarm at runtime, I get an error message: no matching function for call to 'TimeAlarmsClass::alarmRepeat(int, int, int, String&)'
Simplefied sample:
String MethodName = "Red";
int Hour = 10;
int Minute = 0;
int Second = 0;
Alarm.alarmRepeat(Hour,Minute,Second, MethodName);
I understand why this happens: There is no matching function in the library that takes a string as a valid argument. So my question is: How do I cast a string to onTick_t type? Or is there another (better) way to dynamically add alarms to the TimeAlarms class?
Any help is greatly appreciated!