TimeAlarms which set manually

I am trying to make a code for the TimeAlarm in arduino but i want to
set the alarm time using matrix keypad (3x4). i don’t know how to
revise the code because the example code of the time alarm have
already a time set that can be change inside the code… please help …
thank you…
i am using RTC, LCD, keypad and arduino Mega at this project. unfortunately, im still a beginner in coding at arduino… how can i change the
Alarm.alarmOnce(11,5,0, MorningAlarm);
so that i can change the time of the alarm depends the usage of a specific day.

Just wanted to let you know that this forum is about the Spark Devices. Although they share a lot of similarities with arduinos, they are also very different. It may well be that the TimeAlarms code on the Spark does not work on the arduino, and the other way around. Although this community is very capable, it’s perhaps best that you ask for help in a more relevant community, since there will be porting difficulties involved, which will make it harder than it has to be.
On another note, why not just get rid of the Arduino, and move over to the much more awesome Spark? It’s very similar to arduino, and therefor easy to learn, but can do a lot more (awesome) things. And for this price, it’s going to be (really) hard to beat!


ok… after this project ill try to use the spark. but now, it is a requirement for us to use arduino for this project but after this. i would surely try to use this device… thank you very much…

1 Like

Hi @ellinnaj04

Here is some general advice: try to think of your program as a state machine (hope you have studied those). First you start off in an “idle” state, then when you hit the first key, you move to a “digit1” state, then another key and “digit2” etc. until you enter the full time. The states can be an enum or they can be integers (0, 1, 2, 3,…). Every time you go around the loop() function, you decide to stay in the current or move to a different one based on your code.

You will get a lot further asking for help if you show people what you have tried on your own so far. Since this sounds like homework for a class, most people would point you in the right direction but not do the work for you.

Good luck!

1 Like