You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-21Lines changed: 47 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,61 +2,87 @@
2
2
3
3
The **RTC_DS1307_Library** allows easy interaction with the DS1307 Real-Time Clock (RTC) module, offering advanced functions for managing time and additional configurations such as square wave output and NV-RAM.
4
4
5
+
## What's New in v1.1.1
6
+
7
+
This release includes significant improvements and new features:
8
+
9
+
-**Added support for 12-hour and 24-hour time formats.** You can now switch between these formats using the `SET_FORMAT` command.
10
+
-**Added two Python tools in the `tools/` directory:**
11
+
-`rtc_sync.py`: Synchronizes the RTC with the system time (supports UTC and local time).
12
+
-`local_test.py`: Detects the system timezone and displays UTC and local times.
13
+
-**Updated documentation.** The repository now includes three versions of the DS1307 datasheet (`Dallas`, `Maxim`, and `Spanish`).
14
+
5
15
## Features
16
+
6
17
- Configuration and retrieval of time in Unix timestamp format.
18
+
- Support for both **12-hour and 24-hour formats** with AM/PM indication.
7
19
- Reading and writing to the DS1307's battery-backed RAM.
8
20
- Control of square wave output with configurable frequencies (1Hz, 4kHz, 8kHz, and 32kHz).
9
21
- Support for synchronization with the [TimeLib](https://github.com/PaulStoffregen/Time) library.
10
-
- Compatible with Arduino, ESP32, and ESP8266.
22
+
- Compatible with **Arduino, ESP32, and ESP8266**.
The library is available directly in the **Arduino Library Manager**.
29
+
30
+
1. Open the **Arduino IDE**.
31
+
2. Go to `Sketch -> Include Library -> Manage Libraries...`.
32
+
3. Search for **RTC_DS1307_Library**.
33
+
4. Click **Install**.
34
+
35
+
### **Option 2: Manual Installation**
36
+
13
37
1. Download this repository as a ZIP file.
14
38
2. Open the Arduino IDE.
15
39
3. Go to `Sketch -> Include Library -> Add .ZIP Library...`.
16
40
4. Select the downloaded ZIP file.
17
41
5. The library is now ready to use.
18
42
19
43
## Basic Example
20
-
This example demonstrates how to initialize the DS1307 module, configure it with the current time, and continuously read the time. It is ideal for verifying the basic functionality of the RTC and establishing a foundation for more advanced projects.
44
+
45
+
This minimal example demonstrates how to initialize the DS1307 module and retrieve the current time:
21
46
22
47
```cpp
23
48
#include<Wire.h>
24
49
#include<DS1307Lib.h>
25
-
#include<TimeLib.h>
26
50
27
51
voidsetup() {
28
52
Serial.begin(9600);
29
53
Wire.begin();
30
-
31
-
if (!RTC.begin()) {
32
-
Serial.println("DS1307 not detected");
33
-
while (1);
34
-
}
35
-
36
-
// Configure the RTC with the current time
37
-
RTC.set(now());
54
+
RTC.begin();
38
55
}
39
56
40
57
voidloop() {
41
-
// Read and display the current time
42
-
time_t currentTime = RTC.get();
43
-
Serial.print("Current time: ");
44
-
Serial.println(currentTime);
58
+
Serial.println(RTC.get());
45
59
delay(1000);
46
60
}
47
61
```
48
62
49
-
## Contributions
50
-
If you encounter an issue or have ideas to improve this library:
51
-
1. Create an **issue** in the repository.
52
-
2. You can also submit a **pull request** with your suggestions.
63
+
## New Commands
64
+
65
+
-**SET_FORMAT**: Switch between 12-hour and 24-hour formats.
66
+
```
67
+
SET_FORMAT 12 // Sets the RTC to 12-hour mode
68
+
SET_FORMAT 24 // Sets the RTC to 24-hour mode
69
+
```
70
+
-**Python Tools for Synchronization**
71
+
-`rtc_sync.py COM5 utc` Syncs the RTC with system UTC time.
72
+
-`rtc_sync.py COM5 local` Syncs the RTC with system local time.
53
73
54
74
## License
75
+
55
76
This library is distributed under the GNU Lesser General Public License (LGPL) version 3. See the `COPYING.LESSER.txt` file for more details.
0 commit comments