How to reset a repeating alarm using TimeAlarms Library

I've been trying to change the time of a repeating alarm using the TimeAlarms library with no success. I want to be able to do this without changing and restarting the program. I'm making a timer and control system for a pool and will eventually want to change the time of the alarms by using up/down/enter buttons via a menu. My code is below. The commented lines are ones that didn't work. Actually, none of this has worked. Below is the serial readout from the loop section leading up to triggering the code below. It can be seen from the readout that the time does change, but not the time I would like it to. For testing, I have the alarm triggering a second time 4 seconds after the alarm that shuts it off.

11:29:59 Filter 1 On ID = 3 Filter1 On time = 41398 Filter 1 Off ID = 3 Filter1 Off time = 41401

11:30:00 Filter 1 On ID = 3 Filter1 On time = 41398 Filter 1 Off ID = 3 Filter1 Off time = 41401

setNewAlarmTime() **************************************************** triggered Newstart alarm value = 8

11:30:01 Filter 1 On ID = 3 Filter1 On time = 8 Filter 1 Off ID = 3 Filter1 Off time = 41401

11:30:02 Filter 1 On ID = 3 Filter1 On time = 8 Filter 1 Off ID = 3 Filter1 Off time = 41401

void setNewAlarmTime(){
time_t newStart1, newOff1;
Serial.println();  
Serial.println("setNewAlarmTime() **************************************************** triggered");

  

Alarm.disable(Filt1Off);
//void free(AlarmID_t Filt1On);

//newStart1=hour(11);
//newStart1=newStart1 + minute(30);
//newStart1=newStart1 + second(5);
newStart1=(11,30,8);

Serial.print("Newstart alarm value = ");
Serial.println(newStart1);

Alarm.write (Filt1On, newStart1);

//Alarm.enable(Filt1On);


Serial.println(); 
    }
//void free(AlarmID_t Filt1On);

You create a new variable called File1On, of type AlarmID_t, and then free that. Clearly, you have no clue what free does. Or what you are doing...

//newStart1=hour(11);
//newStart1=newStart1 + minute(30);
//newStart1=newStart1 + second(5);

So, clearly newStart1 isn't an int.

Every Alarm instance has an ID. If you want to modify an existing alarm, you MUST save its ID.

Gee thanks for the positive comments Paul. So glad I asked for help here on the forum. Clearly if I was a wizard at this, I wouldn't be asking questions. I thought the forum was a place us inexperienced could resolve problems with our programming. I wasn't finding any answers after 2 hours of searching, so I created the post. Do you always denigrate newbies in your comments? If you think I'm that stupid, you don't have to respond to morons like me.

Filt1On was declared in setup as demonstrated in the example sketch that comes with the alarms library. I didn't want to put every line of code in the post to keep it simple. I thought that if I've already declared it, it doesn't need saving.

As I said, the commented lines were ones which do not work, and free was one of them. It was just something I tried because nothing else was working. In the Time library, time_t is declared as an integer, that is why I used it to declare newStart1.

So, I'm now no further educated than before I asked the question. Some code to resolve the issue would have been beneficial. I may not know what I'm doing at the moment, but I do know how to treat people with respect.

So, I’m now no further educated than before I asked the question.

Well, that’s too bad. I told you that you need to keep track of the Alarm IDs. I can’t see that you do that, because you decided that we didn’t need to see all of your code.

You have far too much code for someone who can’t even reset an alarm.

Sorry to trouble you paul. Hopefully someone else will see the post and give me some positive response.

Gadgetman9: Sorry to trouble you paul. Hopefully someone else will see the post and give me some positive response.

Doubtful if you're not going to post complete code.

I tried to put the entire program in, but the site said it did not allow over 9000 characters. Oh well, I'll figure this out somehow.

Gadgetman9: I tried to put the entire program in, but the site said it did not allow over 9000 characters. Oh well, I'll figure this out somehow.

Quit whining and acting all defeated and put it as an attachment.

If you're not willing to read the instructions, then don't get mad when things don't work out for you the way you want.

http://forum.arduino.cc/index.php?topic=148996.0

Pay particular attention to point 7 and 8, but they are all important.

Thanks, but I did figure it out.

I have never done this but, perhaps something like this:

AlarmID_t myID = Alarm.timerRepeat(10, testAlarm);

Alarm.write(myID, 8 ); //from 10s to 8 seconds

And what did you do?

LarryD, I sent you a pm.