It won't work because it's not valid C code.
Neither the text inside the "(" and ")" nor the statements after each if are valid.
Every single line is wrong. Your if statements are so messed up that I'm not sure what you are trying to do.
I guess you're trying to say (in pseudo-code)
if the time is >= 06:00
call the function sunrise_cycle();
if the time is >= 9:30
call the function daytime_cycle();
if the time is >= 19:00
call the function sunset_cycle();
if the time is >= 09:25
call the function night_time_cycle();
Note that if the time is >= 06:00, it will also be greater than all your other times, so you'll need to change your if statements to a series of if/else if statements, like this:
if ()
//do something
else if ()
//do something
else if ()
//do something
I'm not familiar with the Arduino time library so it's a little hard to tell you what to do to fix your code, especially since it isn't clear what you want to do.
One big thing:
You don't put the word void in front of calls to functions. The word void is used when you define a function to indicate that the function does not return a result.
It's clear from what you posted that you don't know the first thing about the C language. I suggest you get a book on C and read it, doing the tutorials, before you start trying to write original programs.
To use a cooking analogy, you are trying to make a soufflé when you don't know how to heat up a can of soup in a microwave.
iwright13:
Hey all, so I am having trouble figuring out why this won't work. Can anyone take a look at my code and help me?
[code]
// I used the time_t t =now() to declare t
if (t >= hour(6) minute(00) second(00))
void sunrise_cycle();
if (t >= hour(9) minute(30) second(00))
void daytime_cycle();
if (t >= hour(19) minute(00) second(00))
void sunset_cycle();
if (t >= hour(9) minute(15) second(00))
void night_time_cycle();
[/code]