Table of Contents

ow_next

WMPRO >= 1.0 WMMEGA FW >= 2.0

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

Description

mixed ow_next ( )

This function continues a OneWire bus scan and provides the address of the next device found. Currently only DS18B20 temperature sensors are detectable.

Parameters

None

Return Values

An array of 8 elements containing the unique OneWire address. Returns int 0 if no more devices were detected.

Example

<?
  $arr=ow_first();
  if ($arr) {  // first device was detected, let's get the second device now
    $arr=ow_next();
    if ($arr) {
      $devname=sprintf("%02X%02X%02X%02X%02X%02X%02X%02X",$arr[0],$arr[1],$arr[2],$arr[3],$arr[4],$arr[5],$arr[6],$arr[7]);
      print("Detected a second OneWire device ".$devname);
    }
  } else {
    print("No devices detected.");
  }
?>

See Also

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

ow_read() - Read a byte from the OneWire bus

ow_read_temp() - Read a temperature from a device on the OneWire bus

ow_reset() - Reset the OneWire bus

ow_write() - Write a byte to the OneWire bus

sprintf() - Return a formatted string