User Tools

Site Tools


en-us_commands:reference:irtcsetalarm1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en-us_commands:reference:irtcsetalarm1 [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:irtcsetalarm1 [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
-// Alarm 1 every day at 08:30:00 +void setup() { 
-IrtcSetAlarm1(IRTC_ALARM1_MATCH_HOUR_MINUTE_SECOND, 1, 8, 30, 0); +  Serial.begin(115200); 
-IrtcAlarmEnable(1, true);+  if (!IrtcBegin()) return;  // Check the DS3231 RTC connection and begin operation. 
 +  IrtcSetAlarm1(IRTC_ALARM1_MATCH_HOUR_MINUTE_SECOND, 1, 8, 30, 0);  // Set alarm 1, including seconds. 
 +  IrtcSetAlarm2(IRTC_ALARM2_MATCH_HOUR_MINUTE, 1, 17, 30);  // Set alarm 2 with minute resolution. 
 +  IrtcAlarmEnable(1, true);  // Enable or disable the specified alarm. 
 +  IrtcAlarmEnable(2, true);  // Enable or disable the specified alarm. 
 +
 + 
 +void loop() { 
 +  bool alarm1Enabled = false; 
 +  bool alarm1Triggered = false; 
 +  IrtcAlarmEnabled(1, alarm1Enabled);  // Check whether the specified alarm is enabled. 
 +  if (alarm1Enabled && IrtcAlarmTriggered(1, alarm1Triggered, true) && alarm1Triggered) {  // Check whether an alarm has triggered and optionally clear its status. 
 +    Serial.println(F("alarm 1")); 
 +  } 
 +  delay(50); 
 +}
 </code> </code>
  
Line 24: Line 39:
  
 Run each device's corresponding ''Begin'' command first. Check I²C addresses and pin sharing; if the ''bool'' return value is ''false'', inspect wiring and power. Run each device's corresponding ''Begin'' command first. Check I²C addresses and pin sharing; if the ''bool'' return value is ''false'', inspect wiring and power.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:irtcbegin|IrtcBegin() View detailed description]]
 +  * [[:en-us_commands:reference:irtcread|IrtcRead() View detailed description]]
 +  * [[:en-us_commands:reference:irtcset|IrtcSet() View detailed description]]
 +  * [[:en-us_commands:reference:irtcunixtime|IrtcUnixTime() View detailed description]]
 +  * [[:en-us_commands:reference:irtcgettemperature|IrtcGetTemperature() View detailed description]]
 +  * [[:en-us_commands:reference:irtctimevalid|IrtcTimeValid() View detailed description]]
 +  * [[:en-us_commands:reference:irtcclearoscillatorstopflag|IrtcClearOscillatorStopFlag() View detailed description]]
 +  * [[:en-us_commands:reference:irtcsetalarm2|IrtcSetAlarm2() View detailed description]]
 +  * [[:en-us_commands:reference:irtcalarmenable|IrtcAlarmEnable() View detailed description]]
 +  * [[:en-us_commands:reference:irtcalarmenabled|IrtcAlarmEnabled() View detailed description]]
 +  * [[:en-us_commands:reference:irtcalarmtriggered|IrtcAlarmTriggered() View detailed description]]
 +  * [[:en-us_commands:reference:irtcsquarewave|IrtcSquareWave() View detailed description]]
 +  * [[:en-us_commands:reference:irtc32khz|Irtc32kHz() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/irtcsetalarm1.1788785568.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki