Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Seeed-Studio/Seeed_Arduino_RTC
When your project needs to be unplugged, how to keep the time counting? This library can help you set up the current time.
https://github.com/Seeed-Studio/Seeed_Arduino_RTC
ds1307 grove grovelibrary rtc
Last synced: about 2 months ago
JSON representation
When your project needs to be unplugged, how to keep the time counting? This library can help you set up the current time.
- Host: GitHub
- URL: https://github.com/Seeed-Studio/Seeed_Arduino_RTC
- Owner: Seeed-Studio
- License: mit
- Created: 2020-07-16T06:12:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-08T00:41:16.000Z (almost 4 years ago)
- Last Synced: 2024-08-07T18:27:43.043Z (5 months ago)
- Topics: ds1307, grove, grovelibrary, rtc
- Language: C++
- Homepage:
- Size: 43 KB
- Stars: 8
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Seeed_Arduino_RTC [![Build Status](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_RTC.svg?branch=master)](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_RTC)
## Introduction
Seeed Arduino RTC is a Arduino library for RTC Moudle. At present, samd21 is supported and samd51 has built-in RTC module.
## How to install Arduino Library
please refer [here](https://wiki.seeedstudio.com/How_to_install_Arduino_Library/).## Usage
```C++
#include "RTC_SAMD21.h"
#include "DateTime.h"RTC_SAMD21 rtc;
void setup()
{
rtc.begin();Serial.begin(115200);
while (!Serial)
{
;
}
DateTime now = DateTime(F(__DATE__), F(__TIME__));
Serial.println("adjust time!");
rtc.adjust(now);now = rtc.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();}
void loop()
{
now = rtc.now();Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();}
```
## API Reference
- **begin(*void*) : bool**
```C++
rtc.begin()
```
- **now(*void*) : DateTime**
```C++
DateTime now = rtc.now();
```
- **adjust(*const DateTime*) : void**
```C++
DateTime now = DateTime(F(__DATE__), F(__TIME__));
rtc.adjust(now);
DateTime now = DateTime(2020, 7, 15, 0, 0, 0);
rtc.adjust(now);
```
- **setAlarm(*const DateTime*) : void**
```C++
DateTime alarm = DateTime(2020, 7, 15, 18, 0, 0);
rtc.setAlarm(now);
```
- **alarm(*void*) : DateTime**
```C++
DateTime now = rtc.alarm();
```
- **disableAlarm(*uint8_t*) : void**
```C++
rtc.disableAlarm(0);
```
- **enableAlarm(*uint8_t*) : void**
```C++
rtc.enableAlarm(0);
```
- **attachInterrupt(*rtcCallBack*) : void**
```C++
rtc.attachInterrupt(rtcCallBack);
```
- **detachInterrupt(*void*) : void**
```C++
rtc.detachInterrupt();
```----
## License
This software is written by seeed studio
and is licensed under [The MIT License](http://opensource.org/licenses/mit-license.php). Check License.txt for more information.Contributing to this software is warmly welcomed. You can do this basically by
[forking](https://help.github.com/articles/fork-a-repo), committing modifications and then [pulling requests](https://help.github.com/articles/using-pull-requests) (follow the links above
for operating guide). Adding change log and your contact into file header is encouraged.
Thanks for your contribution.Seeed Studio is an open hardware facilitation company based in Shenzhen, China.
Benefiting from local manufacture power and convenient global logistic system,
we integrate resources to serve new era of innovation. Seeed also works with
global distributors and partners to push open hardware movement.