Python library for RTC DS3231



  • Hi all,

    I wrote a python library for the DS3231, it should work with th DS1307 too because the i2c address and the registrers are the same. Just follow the steps on the readme file to put it working.

    https://github.com/jorgegarciadev/RTC_SDL_DS3231



  • @jorgegarciadev thank you for this! :) I am getting the following error and would appreciate it if you can assist...

    Test SDL_DS3231 Version 1.0 - SwitchDoc Labs

    Program Started at:2017-07-02 14:12:09

    Raspberry Pi= 2017-07-02 14:12:09
    Traceback (most recent call last):
    File "test_ds3231.py", line 37, in <module>
    print("DS3231=\t\t%s" % ds3231.read_datetime())
    File "/root/ds3231/SDL_DS3231.py", line 155, in read_datetime
    return datetime((century - 1) * 100 + self._read_year(),
    File "/root/ds3231/SDL_DS3231.py", line 132, in _read_year
    return _bcd_to_int(self._read(self._REG_YEAR))
    File "/root/ds3231/SDL_DS3231.py", line 97, in _read
    returndata = self._i2c.readBytes(self._addr, data, 1)
    IOError: I2C transaction failed.


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.