w1temp 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/w1temp.rb +6 -0
- metadata +1 -1
data/lib/w1temp.rb
CHANGED
@@ -4,6 +4,12 @@ class Temperature
|
|
4
4
|
`sudo modprobe w1-gpio`
|
5
5
|
end
|
6
6
|
|
7
|
+
def name
|
8
|
+
paths = Dir["/sys/bus/w1/devices/*"]
|
9
|
+
name = paths.select{|path| path.include?('-')}.first.split('/').last
|
10
|
+
return name.strip
|
11
|
+
end
|
12
|
+
|
7
13
|
def reading
|
8
14
|
paths = Dir["/sys/bus/w1/devices/*"]
|
9
15
|
temperature_sensor_path = paths.select{|path| path.include?('-')}.first + '/w1_slave'
|