ds18b20 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +31 -3
- data/lib/ds18b20/parser.rb +2 -1
- data/lib/ds18b20/version.rb +1 -1
- metadata +1 -2
- data/Gemfile.lock +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51d15c26c2b2aa8d894e70c113863d2006271dd2
|
4
|
+
data.tar.gz: 8a381fddeb0939c0e9633f1c5a978ea01238fcdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35884cac26ceb602327ff77abff5c7b6b520d8da22912c9479b1d980ab8bbe3e3e52227cfaa6dbf0bc2b0736bcdcc4277cbe012b7acc8ab9b370ef80dcaf40f2
|
7
|
+
data.tar.gz: a343992d6a73170f1baaeb3cc1dabac6c4a96785067508cc61d27802692c0d7904e8333a418565188cfa3a469e957fb58763b3f526dcd523c2d8ea5fa202d6e7
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# DS18B20
|
2
|
+
|
2
3
|
|
3
4
|
[](https://travis-ci.org/owaiswiz/ds18b20)
|
4
5
|
|
5
|
-
# DS18B20
|
6
6
|
|
7
7
|
This gem makes interfacing with the DS18B20 temperature easier over 1-Wire.
|
8
8
|
|
@@ -31,7 +31,35 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
## Usage
|
33
33
|
|
34
|
-
|
34
|
+
### 1. Require
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
require 'ds18b20'
|
38
|
+
```
|
39
|
+
|
40
|
+
|
41
|
+
### 2. Create Instance with Proper File Path
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
sensor = Ds18b20::Parser.new("/sys/bus/w1/devices/28-800000048d57/w1_slave")
|
45
|
+
```
|
46
|
+
|
47
|
+
|
48
|
+
### 3. Getting Temperature
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
sensor.celsius
|
52
|
+
#=> 28.5625
|
53
|
+
|
54
|
+
|
55
|
+
sensor.fahrenheit
|
56
|
+
#=> 82.0625
|
57
|
+
|
58
|
+
|
59
|
+
sensor.kelvin
|
60
|
+
#=> 300.9
|
61
|
+
```
|
62
|
+
|
35
63
|
|
36
64
|
## Development
|
37
65
|
|
data/lib/ds18b20/parser.rb
CHANGED
@@ -3,7 +3,7 @@ module Ds18b20
|
|
3
3
|
class Parser
|
4
4
|
|
5
5
|
ERROR_READINGS = [85000,127687]
|
6
|
-
MAXIMUM_RETRIES =
|
6
|
+
MAXIMUM_RETRIES = 3
|
7
7
|
|
8
8
|
def initialize(file_location)
|
9
9
|
@file_location = file_location
|
@@ -53,6 +53,7 @@ module Ds18b20
|
|
53
53
|
sleep 0.1
|
54
54
|
retry
|
55
55
|
else
|
56
|
+
@retries = 0
|
56
57
|
raise Ds18b20::InvalidReadingError
|
57
58
|
end
|
58
59
|
end
|
data/lib/ds18b20/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ds18b20
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owais
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- ".rspec"
|
64
64
|
- ".travis.yml"
|
65
65
|
- Gemfile
|
66
|
-
- Gemfile.lock
|
67
66
|
- LICENSE.txt
|
68
67
|
- README.md
|
69
68
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
ds18b20 (0.1.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
diff-lcs (1.3)
|
10
|
-
rake (10.5.0)
|
11
|
-
rspec (3.7.0)
|
12
|
-
rspec-core (~> 3.7.0)
|
13
|
-
rspec-expectations (~> 3.7.0)
|
14
|
-
rspec-mocks (~> 3.7.0)
|
15
|
-
rspec-core (3.7.0)
|
16
|
-
rspec-support (~> 3.7.0)
|
17
|
-
rspec-expectations (3.7.0)
|
18
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
-
rspec-support (~> 3.7.0)
|
20
|
-
rspec-mocks (3.7.0)
|
21
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
-
rspec-support (~> 3.7.0)
|
23
|
-
rspec-support (3.7.0)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
bundler (~> 1.16)
|
30
|
-
ds18b20!
|
31
|
-
rake (~> 10.0)
|
32
|
-
rspec (~> 3.0)
|
33
|
-
|
34
|
-
BUNDLED WITH
|
35
|
-
1.16.0
|