Giter VIP home page Giter VIP logo

micropython-ds1302-rtc's Introduction

Micorpython DS1302 RTC Clock driver

This is a pure Micropython DS1302 RTC Clock driver. This is based on microbit code of microbit-lib https://github.com/shaoziyang/microbit-lib

This has been tested and working on ESP32 but should work with any micropython supported device.

Dirver documentation

(Adapted from https://github.com/shaoziyang/microbit-lib/blob/master/misc/DS1302/README.md)

DS1302 is real-time clock (RTC) with serial interface, 31 * 8 data ram.

API

  • start()
    start RTC.

  • stop()
    stop/pause RTC

  • DateTime(DT = None)
    get / set DateTime. If no paramter given, it will return current datetime, otherwise it will set datatime.
    datatime format: [Year, month, day, weekday, hour, minute, second]

  • Year(year = None)
    get / set year.

  • Month(month = None)
    get / set month.

  • Day(day = None)
    get / set day.

  • Weekday(weekday = None)
    get / set month.

  • Hour(hour = None)
    get / set hour.

  • Minute(minute = None)
    get / set minute.

  • Second(second = None)
    get / set second.

  • ram(reg, dat = None)
    get / set ram data (31 bytes).

example

from machine import Pin
import DS1302

ds = DS1302.DS1302(Pin(5),Pin(18),Pin(19))

ds.DateTime()
ds.DateTime([2018, 3, 9, 4, 23, 0, 1, 0])

ds.Hour()
ds.Second(10)

micropython-ds1302-rtc's People

Contributors

omarbenhamid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.