User Tools

Site Tools


en-us_commands:reference:irtcsquarewave

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
en-us_commands:reference:irtcsquarewave [2026/09/08 00:53] – 바깥 편집 127.0.0.1en-us_commands:reference:irtcsquarewave [2026/09/14 20:30] (current) – external edit 127.0.0.1
Line 14: Line 14:
  
 ===== Example ===== ===== Example =====
 +
 +This example connects a DS3231 RTC module to the MPINO-16A8R8T I²C port. The RTC's 32 kHz and square-wave outputs use different pins.
  
 <code cpp> <code cpp>
 void setup() { void setup() {
   Serial.begin(115200);   Serial.begin(115200);
-  if (!IrtcBegin()) return;  // Check the DS3231 RTC connection and begin operation. +  if (!IrtcBegin())  // Check the DS3231 connection and start the RTC. 
-  IrtcSquareWave(true, IRTC_SQUARE_WAVE_1HZ);  // Set the RTC square-wave output+    Serial.println(F("DS3231 not found")); 
-  Irtc32kHz(true);  // Enable or disable the RTC 32kHz output. +    return;
-+
- +
-void loop() { +
-  if (Iup(0, IdigitalRead(0, 5))) {  // Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state. / Return true only at the instant the input changes from OFF to ON. +
-    IrtcSquareWave(false);  // Set the RTC square-wave output. +
-    Irtc32kHz(false) // Enable or disable the RTC 32kHz output.+
   }   }
 +  const bool configured = IrtcSquareWave(true, IRTC_SQUARE_WAVE_1HZ);  // Output a 1 Hz square wave on the RTC SQW pin.
 +  Serial.println(configured ? F("Output enabled") : F("RTC setup failed"));
 } }
 +
 +void loop() {}
 </code> </code>
  
en-us_commands/reference/irtcsquarewave.1788796402.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki