Hi! So I am trying to use the time functions so that my fish feeder will only trigger at certain times. However, this fish feeder is dependent on a sensor being triggered by the fish, and the code should not stop running till the fish have triggered the sensor 18 times.
Right now, the way the code is, its only checking at that specific time to see whether or not there is a signal coming in, and if there isn't a signal, the code stops - it does not keep running till the condition of 18 triggers has been satisfied. The code is attached (note: the comment on the time is wrong, I changed the time). What should I do?
setTime(15, 14, 0, 2, 12, 15); // set date/time to 12:00 on December 2th 2015
Alarm.alarmRepeat(15, 14, 10, DailyStartTimer1);
Alarm.alarmRepeat(15, 14, 10, TakeSensorData); //at 1:00pm it should run the code --> question is , will it keep running till it reaches 18?
The comments don't agree with the code. Since I didn't look up the functions to begin with, I was confused for a while. Since you are likely to keep changing the numbers while you're testing, remove the specifics from the comments. Something like this...
setTime(15, 14, 0, 2, 12, 15); // set date/time Hr, Min, Sec, Day, Month, Year
Alarm.alarmRepeat(15, 14, 10, DailyStartTimer1);
Alarm.alarmRepeat(15, 14, 10, TakeSensorData); //at H, M, S it should run the code
Currently your loop() does nothing except check the alarms. Why not put the fish feeding counter update there? Then each time the function runs to feed the fish, it can reset the counter.