w1temp 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/w1temp.rb +3 -3
- metadata +1 -1
data/lib/w1temp.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
class
|
2
|
-
def self.
|
1
|
+
class TemperatureSensor
|
2
|
+
def self.initialize
|
3
3
|
`sudo modprobe w1-gpio`
|
4
4
|
`sudo modprobe w1-gpio`
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
7
|
+
def reading
|
8
8
|
paths = Dir["/sys/bus/w1/devices/*"]
|
9
9
|
temperature_sensor_path = paths.select{|path| path.include?('-')}.first + '/w1_slave'
|
10
10
|
file_contents = File.read(temperature_sensor_path)
|