The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


<HTML>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 <title>HiPi::Interface::DS18X20</title></head>

<BODY TOPMARGIN=4 BGCOLOR=#FFFFFF TEXT=#000000 VLINK=#0000CC LINK=#0000CC ALINK=#0000CC>
<FONT FACE="Arial, Lucida, Helvetica" >

<TABLE WIDTH="100%" ALIGN=CENTER CELLPADDING=1 CELLSPACING=0>
<TR>
<TD WIDTH="100%" ALIGN=CENTER>


<A HREF="contents.htm"><img align=center src="home.png" BORDER=0 ALT="Contents"></A>


<A HREF="mod_interface.htm"><img align=center src="up.png" BORDER=0 ALT="Up"></A>

<A HREF="mod_interface.htm"><img align=center src="back.png" BORDER=0 ALT="Previous"></A>

<A HREF="mod_interface_ener002.htm"><img align=center src="forward.png" BORDER=0 ALT="Next"></A>
</TD>
</TR>
<TR>
<TD COLSPAN=2 HEIGHT=2 BGCOLOR="#C0C0C0">
</TD>
</TR>
</TABLE>

<H2>HiPi::Interface::DS18X20</H2><p>The HiPi::Interface::DS18X20 module provides simple read access for 18S20 and 18B20 temperature sensors connected to the W1 kernel device driver for the 1 Wire bus.</p>
<p>It uses <A HREF="mod_device_onewire.htm">HiPi::Device::OneWire</A> as a backend.</p>
<h2>Class Methods</h2>
<h5>HiPi::Interface::DS18X20->list_slaves();</h5>
<pre>    Filters a call to HiPi::Device::OneWire->list_slaves()
    to return only devices in the families 10 and 28
    ( temperature sensors of the types 18S20 and 18B20 )
</pre>
<h2>Object Constructor and Methods</h2>

<h5>my $tmp = HiPi::Interface::DS18X20->new( id => $uniqueid);</h5>
<pre>    Returns a new instance of the HiPi::Interface::DS18X20 class
    for the temperature device with the unique 1 Wire ID $uniqueid.

    You can optionally provide additional key => value pairs 
    specifying 
         correction  -  to be added to the temperature 
                        value returned from the device.
                        default = 0
         divider     -  applied as a divider to the
                        value returned by the device
                        This is useful if you want to
                        convert the raw value from
                        your device to an actual temperature
                        within this module.
                        default = 1
          
    
    my $tmp = HiPi::Interface::DS18X20->new( 
          id         => $uniqueid,
          correction => 775,
          divider    => 1000,
     );</pre>
<h5>$tmp->correction( $newval );</h5>
<pre>    returns the value passed as 'correction' to the constructor.
    if $newval is specified, the correction value is set.</pre>
<h5>$tmp->divider( $newval );</h5>
<pre>    returns the value passed as 'divider' to the constructor.
    if $newval is specified, the divider value is set.</pre>
<h5>$tmp->temperature();</h5>
<pre>    returns the value read from the sensor added to the correction
    value, divided by the divider value:

    return ( $sensorval + $correction ) / $divider;
    
    With default values this is simply
    return ( $sensorval + 0 ) / 1;
</pre>
</FONT>
<br>
<p>
<br>
<hr>
<br>
<center>
<A HREF="contents.htm"><img align=center src="home.png" BORDER=0 ALT="Contents"></A>


<A HREF="mod_interface.htm"><img align=center src="up.png" BORDER=0 ALT="Up"></A>

<A HREF="mod_interface.htm"><img align=center src="back.png" BORDER=0 ALT="Previous"></A>

<A HREF="mod_interface_ener002.htm"><img align=center src="forward.png" BORDER=0 ALT="Next"></A>
</center>

<HR>
<br>
<center><FONT FACE="Arial, Lucida, Helvetica" size="2" color="#000080">HiPi Modules Copyright &#169; 2013 - 2016 Mark Dootson</font></center>
</BODY></HTML>