User Tools

Site Tools


uphp:functions:ow_read_temp

ow_read_temp

WMPRO >= 1.0 WMMEGA FW >= 2.0

Read a temperature from a device on the OneWire bus

Description

float ow_read_temp ( [ array $device_id ] )

Parameter

$device_id: An array of 8 elements containing the unique OneWire address (optional). If not specified the function will send a wildcard to read the first device that responds, which will work if only one temperature sensor is present.

Return Values

A float value containing the temperature in degrees Celsius

Examples

<?
 
  $res=ow_read_temp();
  print("Temperature for the first sensor is ".$res);
 
  $dev=array(0xA0,0x00,0x00,0x04,0x80,0x57,0x77,0x35);
  $res=ow_read_temp($dev);
  print("Temperature for the specified device is ".$res);
 
?>

See Also

ow_first() - Initiate a OneWire bus scan and return the address of the first device found

ow_next() - Return the address of the next OneWire device found (after an ow_first)

ow_read() - Read a byte from the OneWire bus

ow_reset() - Reset the OneWire bus

ow_write() - Write a byte to the OneWire bus

uphp/functions/ow_read_temp.txt · Last modified: 2021/09/13 05:57 (external edit)