: arduinosensor.DS1307

DS1307 realtime clock sensor

Methods

: obj = DS1307(arObj)
: obj = DS1307(arObj, propertyname, propertyvalue ....)

Constructor to create DS1307 sensor

Inputs

arObj - the arduino parent object

propertyname, propertyvalue - optional property name, value pairs. Current known properties are: Current properties are:

i2caddress

I2C address of the DS1307 (default 0x68)

Outputs

obj - created DS1307 object

Example


a = arduino()
rtc = arduinosensor.DS1307(a)

: date = clock(dsObj)
: clock(dsObj, date)

Get/set the DS1307 clock

Inputs

dsObj - the ds1307 object

date - a date vector in same format as datevec and clock

Outputs

date - a date vector in same format as datevec and clock

Example


a = arduino()
rtc = arduinosensor.DS1307(a)
# get and display rtc time as a date string
datestr(rtc.clock)

See also: datevec.

: ctrl = control(dsObj)
: control(dsObj, ctrl)

Get/set the DS1307 clock

Inputs

dsObj - the ds1307 object

ctrl - a structure containing the control bit fields.

Outputs

ctrl - a structure containing the control bit fields.

Control structure fields are: Current properties are:

out

Out bit in the control register

sqwe

Square wave enable bit in control register

rs

The combined RS0, RS1 value

: YN = isstarted(dsObj)

Get whether the RTC clock is currently counting time

Inputs

dsObj - the ds1307 object

Outputs

YN - returns true if the RTC is counting

See also: start, stop.

: start(dsObj)

Start the RTC counting

Inputs

dsObj - the ds1307 object

Outputs

None

See also: datevec.

: stop(dsObj)

Stop the RTC counting

Inputs

dsObj - the ds1307 object

Outputs

None

See also: datevec.

Package: arduino