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

Next revision Both sides next revision
uphp:functions:ow_write [2017/05/11 10:07]
admin created
uphp:functions:ow_write [2017/05/11 22:40]
jeff
Line 1: Line 1:
-======ow_write======+======array_key======
  
-<badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge>+<badge>WMPRO, WMMINI FW >= 1.953</badge> <badge>WMMEGA FW >= 2.0</badge>
  
-Write a byte to the Onewire bus.  This is a low level function allowing custom onewire operations.+Return the key for an <html><b><span style="color:green">array<span style="color:black"></b></html> index
  
 ====Description==== ====Description====
  
 <well size="sm"><html> <well size="sm"><html>
-<span style="font-size:125%;color:green"> +<span style="font-size:125%;color:green">string 
-<span style="color:black">ow_write +<span style="color:black">array_key 
-<span style="color:green">$val+<span style="color:green">array 
 +<span style="color:blue">$array<span style="color:black">, 
 +<span style="color:green">int 
 +<span style="color:blue">$index
 <span style="color:black">) <span style="color:black">)
 </html></well> </html></well>
  
-====Parameter====+====Parameters====
  
-An <html><b><span style="color:green">int<span style="color:black"></b></html> value containing the byte to send to the onewire bus+<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> 
 + 
 +<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)
  
 ====Return Values==== ====Return Values====
  
-none+<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
  
 ====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><? <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> </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>
 +
 ====See Also==== ====See Also====
  
-[[ow_first()]] - Get the first device on the bus+[[array()]] - Create an <html><b><span style="color:green">array<span style="color:black"></b></html>, with optional values
  
-[[ow_next()]] - Get next device on bus+[[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_read_temp()]] - Read a temperature from a device+[[sizeof()]] - Return the number of elements in an <html><b><span style="color:green">array<span style="color:black"></b></html>
  
-[[ow_reset()]] - Reset 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_read()]] - Read a byte from the onewire bus+[[uphp:variables|uPHP Variable Types and Limits]]
  
uphp/functions/ow_write.txt · Last modified: 2021/09/13 05:57 (external edit)