Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Python module for using DS1302 Real Time Clock unit with Raspberry Pi

License

NotificationsYou must be signed in to change notification settings

dimp-gh/rpi-ds1302

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python library for using DS1302 RTC unit with Raspberry Pi.

Depends onWiringPi library.

TODO:

  • split C / CPython / Python code
  • way to set up RTC pins from Python code

Usage

Currently you have to connect RTC unit to the following RPi pins (you can read about RPi pin numberinghere, this library uses wiringPi pin numbering):

  • CLK pin (also can be named SCLK) goes to RPi pin 4.
  • DAT pin (sometimes it is named I/O) goes to RPi pin 5.
  • RST pin goes to RPi pin 6.

There are two ways of using RTC unit from Python code.

Low-level access procedures are implemented inds1302 module.

>>>importds1302>>>ds1302.get_date()(2014,1,20)>>>ds1302.get_time()(15,56,1)>>>ds1302.set_time(14,14,14)>>>ds1302.get_time()(14,14,18)

High-level access procedures are implemented inrpi_time module (this one includes sanity checks for RTC unit and range checks for clock values).

>>>importrpi_time>>>rtc=rpi_time.DS1302()>>>rtc.get_datetime()datetime.datetime(2014,1,20,14,16,27)>>>rtc.set_datetime(datetime(2014,1,20,13,42))True>>>rtc.get_datetime()datetime.datetime(2014,1,20,13,42,2)>>>rtc.reset_clock()>>>rtc.get_datetime()datetime.datetime(2001,1,1,0,0,5)

About

Python module for using DS1302 Real Time Clock unit with Raspberry Pi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp