├── LICENSE ├── Readme.md ├── doc ├── Current_consumption_notes.md ├── Menus.txt ├── eagle │ ├── clock3.png │ └── clock3.txt ├── image │ ├── RTC.jpg │ └── RTC2.jpg └── menu.ods └── src └── Arduino_Clock_3 └── Arduino_Clock_3.ino /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gavinlyonsrepo/Arduino_Clock_3/cc2ba34d7bbadf5b75d5a441bf87cf25499ffda9/LICENSE -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | Overview 3 | -------------------- 4 | * Name : Arduino Clock 3 5 | * Title : Arduino Real Time Alarm Clock DS3231 with TM1638 6 | * Description : 7 | 8 | Arduino Clock with Battery backup (real time clock), 9 | Time, Date, Alarm, Temperature, TM1638 seven segment module output and input, Display , Sleep mode. 10 | 11 | * Author: Gavin Lyons 12 | 13 | Table of contents 14 | --------------------------- 15 | 16 | * [Overview](#overview) 17 | * [Table of contents](#table-of-contents) 18 | * [Hardware](#hardware) 19 | * [Schematic](#schematic) 20 | * [Software](#software) 21 | 22 | Hardware 23 | ------------------------ 24 | The RTC is provided by a DS3231 RTC I2C module. 25 | The DS3231 is a low-cost, extremely accurate I2C 26 | real-time clock (RTC). 27 | The device incorporates a battery input, and maintains 28 | accurate timekeeping when main power to the device 29 | is interrupted. The RTC maintains seconds, minutes, hours, day, date, 30 | month, and year information. Two programmable time-of-day 31 | alarms and a programmable square-wave output are 32 | provided. 33 | 34 | This project allows saving of an Alarm in the RTC and triggers on the SQW output of DS3231. 35 | Pressing S1 stops the Alarm once it is switched on. 36 | An Buzzer is connected as an alarm. You may wish to modify these modules, 37 | depending on your use case, some users remove the power led, charging circuit and pull up resistors. Schematic of module in doc sub-folder. 38 | See here for more info [URL link](https://protosupplies.com/product/ds3231-rtc-with-eeprom-module/) 39 | 40 | ![ScreenShot clock](https://github.com/gavinlyonsrepo/Arduino_Clock_3/blob/master/doc/image/RTC.jpg) 41 | 42 | The I/O to user is provided by a TM1638 Module (8 Push buttons 8 LEDS (LED & KEY)) 43 | These TM1638 modules are commonly available. 44 | They consist of an 8-digit seven segment display with decimal points, 45 | 8 Leds and 8 Push buttons. 46 | 47 | ![ module ](https://github.com/gavinlyonsrepo/pic_16F18446_projects/blob/master/images/TM1638.jpg) 48 | 49 | Notes on current consumption found in a file in doc folder. 50 | 51 | Schematic 52 | --------------------------- 53 | 54 | In the doc folder there is an eagle subfolder with the BOM and schematic image. 55 | 56 | ![ScreenShot schematic](https://github.com/gavinlyonsrepo/Arduino_Clock_3/blob/master/doc/eagle/clock3.png) 57 | 58 | Software 59 | -------------------------------- 60 | 61 | **Menu modes** 62 | 63 | A spreadsheet in doc subfolder of this repo shows the button functions(S1 to S8), 64 | on TM1638 module for the various menus. File is called Menus.ods. 65 | 66 | **Libraries** 67 | 68 | It includes two libraries. Both are found in arduino library manager. 69 | The first one is written by Author. Note the DS3232RTC library 70 | has been heavily updated in Version 2.0.0 and is no longer backward compatible. 71 | See [github issue 1](https://github.com/gavinlyonsrepo/Arduino_Clock_3/issues/1) 72 | 73 | | Library name | Version | Author | Link | 74 | | --- | --- | --- | --- | 75 | | TM1638plus.h | 1.4.0 | Gavin Lyons | [URL Link to library](https://github.com/gavinlyonsrepo/TM1638plus) | 76 | | DS3232RTC.h | 1.2.6 | JChristensen | [URL Link to library](https://github.com/JChristensen/DS3232RTC) | 77 | 78 | -------------------------------------------------------------------------------- /doc/Current_consumption_notes.md: -------------------------------------------------------------------------------- 1 | 2 | Current Consumption notes 3 | ----------------- 4 | 5 | | Brightness level | Current(ma) | Mode | 6 | | --- | --- | --- | 7 | | 0 | 40 | HH:MM:SS | 8 | | 0 | 44 | HH:MM:DD:MM | 9 | | 2 | 66 | HH:MM:SS | 10 | | 2 | 80 | HH:MM:DD:MM | 11 | | 7 | 149 | HH:MM:SS| 12 | | 7 | 195 | HH:MM:DD:MM | 13 | | n/a | 31 | sleep | 14 | 15 | Note: As of first version, Sleep mode does not put micro-controller to sleep just 16 | turns off display. unit is designed to be powered from Wall mount not battery. 17 | 18 | Also there are two power LEDS on TM1638 and RTC modules. which are drawing 19 | a signifcant amount of current perhaps ~10-20mA, these can be removed but are still on during these measurments. 20 | -------------------------------------------------------------------------------- /doc/Menus.txt: -------------------------------------------------------------------------------- 1 | "Switch ",Code,"Main menu","Settings menu","Time set","Date Set","Alarm menu",Brightness 2 | S1,0x01,"Lights on/off",,,,, 3 | S2,0x02,"Time ","Back to Main Menu","Back to Main Menu","Back to Main Menu","Back to Main Menu","Back to Main Menu" 4 | S3,0x04,Date,"timeSet GOTO","DateSet GOTO","Save Time/date","Save Alarm", 5 | S4,0x08,Time/date,"AlarmSet GOTO ",,,"Beep Buzzer", 6 | S5,0x10,Temperature,"brightness GOTO",,,"Clear Alarm", 7 | S6,0x20,"Alarm Time",,,days++,, 8 | S7,0x40,Sleep,,Hour++,months++,Hours++, 9 | S8,0x80,"settings menu",,Minute++,Years++,minutes++,brightness++ 10 | -------------------------------------------------------------------------------- /doc/eagle/clock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gavinlyonsrepo/Arduino_Clock_3/cc2ba34d7bbadf5b75d5a441bf87cf25499ffda9/doc/eagle/clock3.png -------------------------------------------------------------------------------- /doc/eagle/clock3.txt: -------------------------------------------------------------------------------- 1 | Partlist exported from /home/gavin/EAGLE/projects/Arduino_projects/clock3/clock3.sch at 11/06/2019 14:52 2 | 3 | Part Value Device Package Description PROD_ID SPICEPREFIX VALUE 4 | C1 0.1uF C-EU075-052X106 C075-052X106 CAPACITOR, European symbol 5 | C4 22pF C2.5/6 C2.5-6 CAPACITOR 6 | C5 22pF C2.5/6 C2.5-6 CAPACITOR 7 | C6 100nF C2.5/6 C2.5-6 CAPACITOR 8 | C7 10uF CPOL-EUE5-5 E5-5 POLARIZED CAPACITOR, European symbol C 9 | C8 1uF CPOL-EUE5-5 E5-5 POLARIZED CAPACITOR, European symbol C 10 | D1 1N4002 1N4004 DO41-10 DIODE 11 | D2 1N4002 1N4004 DO41-10 DIODE 12 | DS3231RTC DS3231 CONN_06NO_SILK_FEMALE_PTH 1X06_NO_SILK Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections CONN-08437 13 | IC2 LM317 LM317TS 317TS VOLTAGE REGULATOR 14 | J1 TM1638 CONN_05 1X05 Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections 15 | J2 VIN CONN_02PTH2 1X02_BIG Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections 16 | J3 BUZZER HEADER CONN_02PTH2 1X02_BIG Multi connection point. Often used as Generic Header-pin footprint for 0.1 inch spaced/style header connections 17 | R1 220 R-EU_0309/10 0309/10 RESISTOR, European symbol R 18 | R2 660 R-EU_0309/10 0309/10 RESISTOR, European symbol R 19 | R3 10K R-EU_0309/10 0309/10 RESISTOR, European symbol R 20 | R4 10K R-EU_0309/10 0309/10 RESISTOR, European symbol R 21 | R5 10K R-EU_0309/10 0309/10 RESISTOR, European symbol R 22 | R6 10K R-EU_0309/10 0309/10 RESISTOR, European symbol R 23 | R7 2.2K R-EU_0309/10 0309/10 RESISTOR, European symbol R 24 | T1 2N2222 2N2222 TO92-EBC-OVAL NPN TRANSISTOR 25 | U1 328P ATMEGA328P_PDIP DIP28 Atmel 328P IC-09136 328P 26 | X1 16MHZ CRYSTALS-NOGND-HC49 HC49 CRYSTALS CAN NOT GROUNDED 27 | -------------------------------------------------------------------------------- /doc/image/RTC.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gavinlyonsrepo/Arduino_Clock_3/cc2ba34d7bbadf5b75d5a441bf87cf25499ffda9/doc/image/RTC.jpg -------------------------------------------------------------------------------- /doc/image/RTC2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gavinlyonsrepo/Arduino_Clock_3/cc2ba34d7bbadf5b75d5a441bf87cf25499ffda9/doc/image/RTC2.jpg -------------------------------------------------------------------------------- /doc/menu.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gavinlyonsrepo/Arduino_Clock_3/cc2ba34d7bbadf5b75d5a441bf87cf25499ffda9/doc/menu.ods -------------------------------------------------------------------------------- /src/Arduino_Clock_3/Arduino_Clock_3.ino: -------------------------------------------------------------------------------- 1 | //******************* HEADER ******************************** 2 | /* 3 | Name : clock_number_3 4 | Title : Arduino RTC 5 | Description : Arduino RTC using the TM1638 and DS3231 6 | Author: Gavin Lyons 7 | URL: https://github.com/gavinlyonsrepo/Arduino_Clock_3 8 | */ 9 | 10 | //*************************** LIBS ***************** 11 | //Both in library manger 12 | // https://github.com/gavinlyonsrepo/TM1638plus 13 | // https://github.com/JChristensen/DS3232RTC 14 | #include // By Author 15 | #include 16 | 17 | //*************************** GLOBALS & DEFINES******************** 18 | 19 | // TM1638 Setup 20 | // I/O pins on the Arduino connected to Tm1638 strobe, clock, data 21 | #define STROBE_TM 6 22 | #define CLOCK_TM 7 23 | #define DIO_TM 8 24 | TM1638plus TM1638(STROBE_TM, CLOCK_TM , DIO_TM); 25 | 26 | // Intervals and delays 27 | unsigned long previousMillis = 0; 28 | const long interval = 225; // interval at which to debounce button readback function(milliseconds) 29 | #define displayinterval 1500 // interval for displaying Info- once offs, hello etc 30 | 31 | //Pin defines for alarm and buzzer 32 | #define buzzer A2 33 | #define AlarmInput 2 34 | 35 | //Control vars 36 | bool LEDS_on_flag = false; 37 | bool Alarm_set = false; 38 | uint8_t MainMode = 2; 39 | 40 | // ********************* FUNCTIONS PROTOTYPES ************** 41 | void MainMenu(void); 42 | void Display(uint8_t DisplayMode); 43 | void ShowAlarm(void); 44 | void SleepMode(void); 45 | void SettingsMenuDisplay(void); 46 | void SetTime(void); 47 | void SetDate(uint8_t Hours , uint8_t Minutes); 48 | void SetAlarm(void); 49 | void Brightness(void); 50 | uint8_t buttonsRead(void); 51 | void setLEDonoff(void); 52 | 53 | 54 | //***************** SETUP ************************ 55 | void setup() { 56 | /*Serial for debug only 57 | Serial.begin(9600); 58 | Serial.println("Arduino CLock three, Serial comms up, Start");*/ 59 | 60 | //Tm1638 Setup 61 | TM1638.displayBegin(); 62 | 63 | //RTC 64 | setSyncProvider(RTC.get); // the function to get the time from the RTC 65 | if (timeStatus() != timeSet) 66 | //Serial.println("Unable to sync with the RTC"); 67 | while(1)TM1638.displayText("COnnFAiL"); 68 | else 69 | //Serial.println("RTC has set the system time"); 70 | __asm__("nop\n\t"); 71 | 72 | //ALARM Setup 73 | pinMode(buzzer, OUTPUT); 74 | digitalWrite(buzzer, LOW); 75 | pinMode(AlarmInput, INPUT_PULLUP); 76 | ClearAlarm(); 77 | 78 | 79 | TM1638.displayText("HELLO "); 80 | delay(displayinterval); 81 | } 82 | 83 | 84 | 85 | //*************************** MAIN LOOP ************** 86 | void loop() { 87 | 88 | MainMenu(); //Display MainMenu 89 | 90 | if ( !digitalRead(AlarmInput) ) 91 | { 92 | RTC.alarm(ALARM_2); // reset the alarm flag 93 | digitalWrite(buzzer, HIGH); 94 | MainMode = 2; 95 | } 96 | } 97 | 98 | 99 | // ********************* FUNCTIONS SPACE ***************** 100 | 101 | 102 | //Function to Display Main Menu 103 | void MainMenu(void) 104 | { 105 | uint8_t buttons = buttonsRead(); 106 | 107 | switch (buttons) 108 | { 109 | case 0x01: 110 | LEDS_on_flag = !LEDS_on_flag ; 111 | setLEDonoff(); 112 | break; 113 | case 0x02 : 114 | MainMode = 2; 115 | Display(MainMode); 116 | break; 117 | case 0x04 : 118 | MainMode = 3; 119 | Display(MainMode); 120 | break; 121 | case 0x08 : 122 | MainMode = 4; 123 | Display(MainMode); 124 | break; 125 | case 0x10 : 126 | MainMode = 5; 127 | Display(MainMode); 128 | break; 129 | case 0x20 : 130 | MainMode = 6; 131 | ShowAlarm(); 132 | break; 133 | case 0x40 : 134 | MainMode = 7; 135 | TM1638.displayText("SLEEP "); 136 | delay(displayinterval); 137 | TM1638.reset(); 138 | break; 139 | case 0x80 : 140 | MainMode = 8; 141 | SettingsMenuDisplay(); 142 | break; 143 | } 144 | if (MainMode == 2) Display(MainMode); //live display 145 | if (MainMode == 4) Display(MainMode); //live display 146 | } 147 | 148 | // Function to display the settings menu Called from Main 149 | void SettingsMenuDisplay(void) 150 | { 151 | TM1638.displayText("SEttInGs"); 152 | while (1) 153 | { 154 | uint8_t buttons = buttonsRead(); 155 | switch (buttons) 156 | { 157 | case 0x02 : MainMode=2; break; 158 | case 0x04 : 159 | SetTime(); 160 | break; 161 | case 0x08 : SetAlarm(); break; 162 | case 0x10 : Brightness(); break; 163 | 164 | } 165 | if (MainMode == 2) break; 166 | 167 | } 168 | } 169 | 170 | // Function to set the Time, called from settings 171 | void SetTime(void) 172 | { 173 | char workstr[11]; 174 | uint8_t Hours = 0; 175 | uint8_t Minutes = 0; 176 | while (1) 177 | { 178 | uint8_t buttons = buttonsRead(); 179 | switch (buttons) 180 | { 181 | case 0x02 : MainMode = 2; break; 182 | case 0x04 : 183 | SetDate(Hours , Minutes); 184 | MainMode = 2; 185 | break; 186 | case 0x40 : 187 | Hours++; 188 | break; 189 | case 0x80 : 190 | Minutes++; 191 | break; 192 | } 193 | if (Hours == 24) Hours = 0; 194 | if (Minutes == 59) Minutes = 0; 195 | sprintf(workstr, "tS. %02d.%02d", Hours, Minutes); 196 | TM1638.displayText(workstr); 197 | buttons = 0; 198 | if (MainMode == 2) break; 199 | } 200 | 201 | } 202 | 203 | // Function to Set Date called from setTime 204 | // passed two integers with the time to set in hours and minutes 205 | void SetDate(uint8_t Hours , uint8_t Minutes) 206 | { 207 | char workstr[13]; 208 | uint8_t Days = 0; 209 | uint8_t Months = 0; 210 | uint8_t Years = 0; 211 | MainMode = 0; 212 | 213 | while (1) 214 | { 215 | uint8_t buttons = buttonsRead(); 216 | 217 | switch (buttons) 218 | { 219 | case 0x02 : MainMode = 2; break; 220 | case 0x04 : MainMode = 3; break; 221 | case 0x20 : 222 | Days++; 223 | break; 224 | case 0x40 : 225 | Months++; 226 | break; 227 | case 0x80 : 228 | Years++; 229 | break; 230 | } 231 | 232 | if (Days == 32) Days = 1; 233 | if (Months == 13) Months = 1; 234 | if (Years == 100) Years = 0; 235 | 236 | sprintf(workstr, "DS.%02d.%02d.%02d", Days, Months, Years); 237 | TM1638.displayText(workstr); 238 | buttons = 0; 239 | if (MainMode == 2) break; 240 | if (MainMode == 3) 241 | { 242 | time_t t; 243 | tmElements_t tm; 244 | tm.Year = y2kYearToTm(Years); 245 | tm.Month = Months; 246 | tm.Day = Days; 247 | tm.Hour = Hours; 248 | tm.Minute = Minutes; 249 | tm.Second = 0; 250 | t = makeTime(tm); 251 | RTC.set(t); // use the time_t value to ensure correct weekday is set 252 | setTime(t); 253 | TM1638.displayText("tInESEt "); 254 | delay(displayinterval); 255 | break; 256 | } 257 | } 258 | } 259 | 260 | //Function to set Alarm called from settings 261 | void SetAlarm(void) 262 | { 263 | 264 | char workstr[11]; 265 | uint8_t Hours = 0; 266 | uint8_t Minutes = 0; 267 | while (1) 268 | { 269 | uint8_t buttons = buttonsRead(); 270 | switch (buttons) 271 | { 272 | case 0x02 : MainMode = 2; break; 273 | case 0x04 : 274 | //Set Alarm 275 | // set Alarm 2 for RTC.setAlarm(alarmType, seconds, minutes, hours, dayOrDate); 276 | RTC.setAlarm(ALM2_MATCH_HOURS, 0, Minutes, Hours, 0); 277 | // clear the alarm flags 278 | RTC.alarm(ALARM_1); 279 | RTC.alarm(ALARM_2); 280 | // configure the INT/SQW pin for "interrupt" operation (disable square wave output) 281 | RTC.squareWave(SQWAVE_NONE); 282 | // enable interrupt output for Alarm 2 only 283 | RTC.alarmInterrupt(ALARM_1, false); 284 | RTC.alarmInterrupt(ALARM_2, true); 285 | Alarm_set = true; 286 | TM1638.displayText("ALRnSEt "); 287 | delay(displayinterval); 288 | MainMode = 2; 289 | break; 290 | case 0x08: 291 | digitalWrite(buzzer, HIGH); 292 | TM1638.displayText("ALRntESt"); 293 | delay(displayinterval); 294 | digitalWrite(buzzer, LOW); 295 | break; 296 | case 0x10: 297 | // initialize the alarms to known values, clear the alarm flags, clear the alarm interrupt flags 298 | ClearAlarm(); 299 | Alarm_set = false; 300 | digitalWrite(buzzer, LOW); 301 | TM1638.displayText("ALRn CLr"); 302 | delay(displayinterval); 303 | break; 304 | case 0x40 : 305 | Hours++; 306 | break; 307 | case 0x80 : 308 | Minutes = Minutes + 5; 309 | break; 310 | } 311 | if (Hours == 24) Hours = 0; 312 | if (Minutes == 60) Minutes = 0; 313 | sprintf(workstr, "AS. %02d.%02d", Hours, Minutes); 314 | TM1638.displayText(workstr); 315 | buttons = 0; 316 | if (MainMode == 2) break; 317 | } 318 | } 319 | 320 | //Function to set brightness called from settings 321 | void Brightness(void) 322 | { 323 | 324 | uint8_t bright = 0x00; 325 | TM1638.displayText(" "); 326 | while (1) 327 | { 328 | uint8_t buttons = buttonsRead(); 329 | switch (buttons) 330 | { 331 | case 0x02 : MainMode = 2; break; 332 | case 0x80 : 333 | bright++; 334 | break; 335 | } 336 | if (bright == 0x08) 337 | { 338 | bright = 0x00; 339 | } 340 | buttons = 0; 341 | TM1638.brightness(bright); 342 | TM1638.displayText("Bright"); 343 | TM1638.displayHex(7, bright); 344 | if (MainMode == 2) break; 345 | } 346 | } 347 | 348 | // Displays selected display mode for Main Menu 349 | //passed integer with display mode, 4 modes 350 | //2.= Just time HH.MM.SS 351 | //3 = just Date DD.MM.YYYY 352 | //4 = Time and Date HH.MM.DD.MM 353 | //5 = Temperature TEMP.NN.NN 354 | void Display(uint8_t DisplayMode) 355 | { 356 | tmElements_t tm; 357 | char timebuf[11]; // Time 358 | char datebuf[12]; // Date 359 | RTC.read(tm); 360 | switch (DisplayMode) 361 | { 362 | case 2 : 363 | sprintf(timebuf, " %02d.%02d.%02d", tm.Hour, tm.Minute, tm.Second); 364 | TM1638.displayText(timebuf); 365 | break; 366 | case 3 : 367 | sprintf(datebuf, "%02d.%02d.%04d", tm.Day, tm.Month, tm.Year + 1970); 368 | TM1638.displayText(datebuf); 369 | break; 370 | case 4 : 371 | sprintf(datebuf, "%02d.%02d.%02d.%02d", tm.Hour, tm.Minute, tm.Day, tm.Month); 372 | TM1638.displayText(datebuf); 373 | break; 374 | case 5 : 375 | char workstr[12]; 376 | uint16_t Temp = RTC.temperature(); 377 | Temp = (Temp / 4.0) * 100; 378 | sprintf(workstr, "TEnP.%d%d.%d%d", (Temp / 1000) % 10, (Temp / 100) % 10, (Temp / 10) % 10, Temp % 10 ); 379 | TM1638.displayText(workstr); 380 | break; 381 | } 382 | } 383 | 384 | //Switch All LEDS on TM1638 on or off, if button S1 pressed on main menu 385 | void setLEDonoff(void) 386 | { 387 | for (uint8_t position = 0; position < 8; position++) 388 | { 389 | TM1638.setLED(position, LEDS_on_flag); 390 | } 391 | } 392 | 393 | // Show the alarm reads the SRAM of DS3231 for alarm 2 and gets 394 | // values and displays them , called from main 395 | void ShowAlarm(void) 396 | { 397 | 398 | if (Alarm_set == true) 399 | { 400 | byte minbyte, minupper , minlower = 0; 401 | byte hourbyte, hourupper, hourlower = 0; 402 | char alarmbuf[11]; // Time 403 | minbyte = RTC.readRTC(0x0B); //read the minute byte value from SRAM location B 404 | hourbyte = RTC.readRTC(0X0C); //read the hour byte from SRAM location C 405 | 406 | minlower = (minbyte) & 0x0F; // select lower nibble 407 | minupper = (minbyte >> 4) & 0X0F; //select upper nibble 408 | minbyte = (minupper * 10) + minlower; 409 | 410 | hourlower = (hourbyte) & 0x0F; // select lower nibble 411 | hourupper = (hourbyte >> 4) & 0X0F; //select upper nibble 412 | hourbyte = (hourupper * 10) + hourlower; 413 | 414 | sprintf(alarmbuf, "ALrN.%02d.%02d", hourbyte, minbyte); 415 | TM1638.displayText(alarmbuf); 416 | } else { 417 | 418 | TM1638.displayText(" no ALrN"); 419 | } 420 | 421 | 422 | } 423 | 424 | // Read and debounce the buttons form TM1638 425 | uint8_t buttonsRead(void) 426 | { 427 | uint8_t buttons = 0; 428 | unsigned long currentMillis = millis(); 429 | if (currentMillis - previousMillis >= interval) { 430 | previousMillis = currentMillis; 431 | buttons = TM1638.readButtons(); 432 | } 433 | return buttons; 434 | } 435 | 436 | // initialize the alarms to known values, clear the alarm flags, clear the alarm interrupt flags 437 | // Called at init(optional) and also by ALarm clear option in Alarm menu 438 | void ClearAlarm(void) 439 | { 440 | RTC.setAlarm(ALM1_MATCH_DATE, 0, 0, 0, 1); 441 | RTC.setAlarm(ALM2_MATCH_DATE, 0, 0, 0, 1); 442 | RTC.alarm(ALARM_1); 443 | RTC.alarm(ALARM_2); 444 | RTC.alarmInterrupt(ALARM_1, false); 445 | RTC.alarmInterrupt(ALARM_2, false); 446 | RTC.squareWave(SQWAVE_NONE); 447 | } 448 | 449 | //*************************** EOF ***************************** 450 | --------------------------------------------------------------------------------