User Tools

Site Tools


uphp:functions:ow_write

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:ow_write [2017/05/11 22:40]
jeff
uphp:functions:ow_write [2021/09/13 05:57] (current)
Line 1: Line 1:
-======array_key======+======ow_write======
  
-<badge>WMPRO, WMMINI FW >= 1.953</badge> <badge>WMMEGA FW >= 2.0</badge>+<badge>WMPRO >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge>
  
-Return the key for an <html><b><span style="color:green">array<span style="color:black"></b></html> index+Write a byte to the OneWire bus
  
 ====Description==== ====Description====
  
 <well size="sm"><html> <well size="sm"><html>
-<span style="font-size:125%;color:green">string +<span style="font-size:125%">ow_write (
-<span style="color:black">array_key ( +
-<span style="color:green">array +
-<span style="color:blue">$array<span style="color:black">,+
 <span style="color:green">int <span style="color:green">int
-<span style="color:blue">$index+<span style="color:blue">$value
 <span style="color:black">) <span style="color:black">)
 </html></well> </html></well>
  
-====Parameters====+This function will write a single byte to the OneWire bus.  This is a low level function allowing custom OneWire operations.
  
-<html><b><span style="color:blue">$array<span style="color:black"></b>: An <b><span style="color:green">array<span style="color:black"></b> with key/value pairs</html>+====Parameter====
  
-<html><b><span style="color:blue">$index<span style="color:black"></b></html>: The index for the array element (the first element is index 0)+<html><b><span style="color:blue">$value<span style="color:black"></b>:  An <b><span style="color:green">integer<span style="color:black"></b></html> value of the byte to send to the OneWire bus
  
 ====Return Values==== ====Return Values====
  
-<html><b><span style="color:green">String<span style="color:black"></b></html> containing the key name of the array element at the specified index+None
  
 ====Example==== ====Example====
- 
-===Create an array with key value pairs, iterate through the array, print out all keys and their associated values=== 
  
 <code php> <code php>
-<pre><? +<? 
-  $arr=array(); +  ow_write(10); 
-  $arr['name']="John"; +  ow_write(11); 
-  $arr['age']=30; +  ow_write(0x55); 
-  $arr['status']=1; +?>
- +
-  for ($i=0; $i < sizeof($arr); $i++) { +
-    $key=array_key($arr,$i); +
-    print("Key at Index ".$i." is ".$key." and value is ".$arr[$key]."\r\n"); +
-  } +
-?></pre> +
-</code> +
- +
-The above example will output: +
-<code> +
-Key at Index 0 is name and value is John +
-Key at Index 1 is age and value is 30 +
-Key at Index 2 is status and value is 1+
 </code> </code>
  
 ====See Also==== ====See Also====
  
-[[array()]] - Create an <html><b><span style="color:green">array<span style="color:black"></b></html>, with optional values+[[ow_first()]] - Initiate a OneWire bus scan and return the address of the first device found
  
-[[array_keys()]] - Return keys for an <html><b><span style="color:green">array<span style="color:black"></b></html> that has key/value pairs+[[ow_next()]] - Return the address of the next OneWire device found (after an ow_first)
  
-[[sizeof()]] - Return the number of elements in an <html><b><span style="color:green">array<span style="color:black"></b></html>+[[ow_read_temp()]] - Read a temperature from a device on the OneWire bus
  
-[[print_r()]] - Dump the contents of an <html><b><span style="color:green">array<span style="color:black"></b></html> to the current output+[[ow_reset()]] - Reset the OneWire bus
  
-[[uphp:variables|uPHP Variable Types and Limits]]+[[ow_read()]] - Read a byte from the OneWire bus
  
uphp/functions/ow_write.1494542454.txt.gz · Last modified: 2021/09/13 05:56 (external edit)