I am helping another person with a sketch which is based on my sketch/alarm clock.
I've asked "LUIDR" but haven't got a reply yet.
But when I take apart the program I am stumped where "CLOCK1" comes from.
Yes, that is really "CLOCK" but as it is ...... used it becomes appended with the 1.
Where I am now in my "journey" I am at a cross road. Some advocate I learn C only. To get a good ground knowledge of the syntax and how things work.
I agree, but others are saying C++. But with that comes the problems of CLASS etc. Which may be beyond me at this point.
Yeah, so why I am doing this you ask? Well, I pretty well have little choice. Although I have my sketch working, I would like to help someone with what I know.
Yes, this is a real "hack job" with what I have done to it to (try) and help the guy.
Surprisingly we are making ground!
To get around it I have written a new alarm routine which is called and it returns a variable to do the "alarm_is_on" thingy.
I don't know how to call any of the sub-set of commands in the "ALARM_CLOCK" which is declared in the file ALARM_CLOCK.H
(I am putting things like names in uppercase for clarity only - I hope.)
I don't understand these lines like:
byte alarm_clock::run()
This is a sub-command of alarm_clock, but unless I am already "in" alarm_clock, (don't know what that means really, but indulge me) I can't call it.
I can see how it is invoked, but I don't know how to invoke it (for example) from one of MY routines.
class alarm_clock
{
public:
alarm_clock(boolean noo);
byte run(); // Returns which alarm is triggered, 0-Max_alarms, 255 means no alarm is triggered.
byte set_alarm(byte alarm_num, byte hr, byte mnt, byte dow); // Returns 255 if parameters are invalid. Returns 0 if valid.
void turn_on(byte alarm_num);
void turn_off(byte alarm_num);
void alarm(int active_alarm);
boolean within(byte a, byte dow);
I can see that this makes "alarm_clock" and it allows me to do things like:
run()
set_alarm(....)
turn_on(byte)
etc.
Well, it sort of work.s
How do I turn on alarm # 1?
I am guessing
turn_on(1);
But that doesn't work.
A couple of efforts on syntax yield little extra that errors:
void foo()
{
turn_on(1);
}
My_routines:759: error: 'turn_on' was not declared in this scope
Which I would expect.
I don't mind trying things, but I don't know how to phrase the question to "Mr GOOGLE" so am trying the human path.
Coffee_Maker_Alarm_7.zip (14.2 KB)