Arduino Toolkit - arduinoioaddons.RTCAddon.DS1307
Properties
Parent - the parent arduino object.
Pins - the pins allocated the addon.
Methods
- :
obj =
DS1307(arObj) - :
obj =
DS1307(arObj,propertyname, propertyvalue ....)
Constructor to create DS1307 addon
Inputs
arObj - the arduino parent object
propertyname, propertyvalue - optional property name, value pairs. Current known properties are:
- address
I2C address of the DS1307 (default 0x68)
Outputs
obj - created DS1307 object
Example
a = arduino() rtc = addon(a, "rtcaddon/ds1307")
- :
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 = addon(a, "rtcaddon/ds1307") # 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.