en-us_commands:reference:irtcsquarewave
This is an old revision of the document!
Table of Contents
IrtcSquareWave()
IrtcSquareWave() configures the RTC square-wave output.
bool IrtcSquareWave(bool enable, uint8_t frequency = IRTC_SQUARE_WAVE_1HZ, bool batteryPowered = false)
Commands
| Command | Arguments | Return Value | Operation |
|---|---|---|---|
IrtcSquareWave(enable, frequency, batteryPowered) | bool enableuint8_t frequency = IRTC_SQUARE_WAVE_1HZbool batteryPowered = false | bool | Configures the RTC square-wave output. |
Example
void setup() { Serial.begin(115200); if (!IrtcBegin()) return; // Check the DS3231 RTC connection and begin operation. IrtcSquareWave(true, IRTC_SQUARE_WAVE_1HZ); // Set the RTC square-wave output. Irtc32kHz(true); // Enable or disable the RTC 32kHz output. } 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. } }
Precautions
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/irtcsquarewave.1788796402.txt.gz · Last modified: by 127.0.0.1
