SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
pcf8563_clock_output.ino
Go to the documentation of this file.
1
30#include <RtcDrv.hpp>
31
32#ifndef SENSOR_SDA
33#define SENSOR_SDA 42
34#endif
35
36#ifndef SENSOR_SCL
37#define SENSOR_SCL 41
38#endif
39
40#ifndef SENSOR_IRQ
41#define SENSOR_IRQ 14
42#endif
43
44
52
53String freq_hz_str[] = {
54 "32.768KHZ",
55 "1.024KHZ",
56 "32HZ",
57 "1HZ",
58 "DISABLE",
59};
60
61
63uint32_t intervalue;
64uint8_t i = 0;
65
66
67void setup()
68{
69 Serial.begin(115200);
70 while (!Serial);
71 if (!rtc.begin(Wire, SENSOR_SDA, SENSOR_SCL)) {
72 Serial.println("Failed to find PCF8563 - check your wiring!");
73 while (1) {
74 delay(1000);
75 }
76 }
77}
78
79
80void loop()
81{
82 if (millis() - intervalue > 5000) {
83 intervalue = millis();
84 Serial.print("Set freq : ");
85 Serial.println(freq_hz_str[i]);
87 i++;
88 i %= 5;
89 }
90}
91
92
@license MIT License
Driver for the PCF8563 real-time clock (RTC) over I2C.
ClockHz
Clock output frequencies for the CLKOUT pin.
@ CLK_32768HZ
32.768 kHz output
@ CLK_1024HZ
1.024 kHz output
void setClockOutput(ClockHz freq)
Configure the clock output (CLKOUT) pin.
bool begin(SensorCommCustom::CustomCallback callback)
Initialize the device using a user-provided transport callback.
SensorPCF8563 rtc
void setup()
String freq_hz_str[]
#define SENSOR_SCL
#define SENSOR_SDA
SensorPCF8563::ClockHz clock_array[]
uint8_t i
uint32_t intervalue
void loop()