Need help programming/using timer alarm code

here is a snippet of the example code provided
#include <Time.h>
#include <TimeAlarms.h>

void setup()
Serial.println(“TimeAlarms Example”);
Serial.println(“Alarms are triggered daily at 8:30 am and 17:45 pm”);
Serial.println(“One timer is triggered every 15 seconds”);
Serial.println(“Another timer is set to trigger only once after 10 seconds”);

setTime(8,29,40,1,1,10); // set time to 8:29:40am Jan 1 2010

Alarm.alarmRepeat(8,30,0, MorningAlarm); // 8:30am every day
Alarm.alarmRepeat(17,45,0,EveningAlarm); // 5:45pm every day

I need to set the time called setTime with intregers i will input, instead of a predefined set time already in the code.
(which is: setTime(8,29,40,1,1,10); // set time to 8:29:40am Jan 1 2010 )

The header file defines each parameter in setTime as: setTime(int hr, int min, int sec, int day, int month, int yr);

so for example: i want the number 7 to be sent to int hr, the number 33 to be sent to int min, etc…

how can i pass values into each of the parameter in setTime?

You could use the serial line to allow you to enter numbers, or you could use up/down/enter buttons. Lots of ways.

what would the code look like? i tired a few ways but ended up with alot of errors.

what would the code look like?

Well, first you have to wait for a character from the serial line. Then you read it, see if is a numeric digit, if it is subtract the ASCII code for zero and that gives you your decimal value. Multiply by a decimal weight (power of ten) and figure out some system of delimeters. Rinse and repeat.

Or use "atoi" and a string - don't forget to null-terminate the string.

This topic comes up at least once a week here, so a little searching will find you lots of answers.

Someone here:,51840.msg369598.html#msg369598 with a very similar problem.