Arduino 1-Wire Device Libraries

DS2438 API

Constructor

DS2438(OneWire *ow, uint8_t *address)
Parameters OneWire *ow Address of a previously constructed OneWire object.
uint8_t *address Address of an 8-byte array containing the device's 1-Wire address

Methods

begin(uint8_t mode)
Initializes the DS2438 device.
Parameters uint8_t mode Any combination of DS2438_MODE_CHA | DS2438_MODE_CHB | DS2438_MODE_TEMPERATURE to configure which features are enabled.
Returns void

update()
Initiates acquisition of a new temperature and voltage values from the DS2438 device.
Parameters none
Returns void

getTemperature()
Returns the temperature value from the most recent update() invocation. If the device has been initialized via begin() but update() has not been invoked then 0 is returned.
Parameters none
Returns double The temperature value in degrees Celsius

getVoltage(int channel)
Returns the raw voltage value from the most recent update() invocation. If the device has been initialized via begin() but update() has not been invoked then 0 is returned.
Parameters int channel DS2438_CHA to return the channel A voltage, DS2438_CHB to return the channel B voltage.
Returns float The voltage value for the selected channel in volts (0-5v).

isError()
Returns True if the most recent update() invocation resulted in an error. Errors may be due to the returned data from the DS2438 device having an invalid CRC, or if begin() was invoked but update() has not yet been invoked.
Parameters none
Returns boolean True if update() resulted in an error, False if a valid temperature/voltage values were acquired.

getTimestamp()
Returns the system value of millis() at the time of the last invocation of update(). This may be used in computations where the time difference between subsequent readings is required.
Parameters none
Returns unsigned long The value of millis() at the time of the last invocation of update(), or 0 if update() has not yet been invoked.


<<Previous Page | Index | Next Page>>