Class: OneWire::Thermometer

Inherits:
Base
  • Object
show all
Defined in:
lib/one_wire/thermometer.rb

Constant Summary collapse

PREFIX =
%w{10 22 28 3B}

Instance Attribute Summary collapse

Attributes inherited from Base

#path

Instance Method Summary collapse

Methods inherited from Base

#dump, #id, #initialize, #name, #w1_slave

Constructor Details

This class inherits a constructor from OneWire::Base

Instance Attribute Details

#last_valueObject (readonly)

Returns the value of attribute last_value.



6
7
8
# File 'lib/one_wire/thermometer.rb', line 6

def last_value
  @last_value
end

Instance Method Details

#valueObject



8
9
10
11
# File 'lib/one_wire/thermometer.rb', line 8

def value
  @last_value = @value
  @value = w1_slave[/t=(\d*)/, 1].to_f / 1000
end