Only your Arduino Board is needed for this example.
1/*2
3 Sleep RTC Alarm for Arduino Zero4
5 Demonstrates the use an alarm to wake up an Arduino zero from Standby mode6
7 This example code is in the public domain8
9 http://arduino.cchttps://www.arduino.cc/en/Tutorial/SleepRTCAlarm10
11 created by Arturo Guadalupi12
13 17 Nov 201514
15 modified16
17 01 Mar 201618
19
20
21 NOTE:22
23 If you use this sketch with a MKR1000 you will see no output on the serial monitor.24
25 This happens because the USB clock is stopped so it the USB connection is stopped too.26
27 **To see again the USB port you have to double tap on the reset button!**28
29*/30
31#include <RTCZero.h>32
33/* Create an rtc object */34
35RTCZero rtc;36
37/* Change these values to set the current initial time */38
39const byte seconds = 0;40
41const byte minutes = 00;42
43const byte hours = 17;44
45/* Change these values to set the current initial date */46
47const byte day = 17;48
49const byte month = 11;50
51const byte year = 15;52
53void setup()54{55
56 pinMode(LED_BUILTIN, OUTPUT);57
58 digitalWrite(LED_BUILTIN, LOW);59
60 rtc.begin();61
62 rtc.setTime(hours, minutes, seconds);63
64 rtc.setDate(day, month, year);65
66 rtc.setAlarmTime(17, 00, 10);67
68 rtc.enableAlarm(rtc.MATCH_HHMMSS);69
70 rtc.attachInterrupt(alarmMatch);71
72 rtc.standbyMode();73}74
75void loop()76{77
78 rtc.standbyMode(); // Sleep until next alarm match79}80
81void alarmMatch()82{83
84 digitalWrite(LED_BUILTIN, HIGH);85}