ds18b20 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd777d91d73f1ead320d2aa633a934b517ad424f
4
- data.tar.gz: 236c03f35d0c660dcb51fa17e05f3290a2e6a51d
3
+ metadata.gz: 51d15c26c2b2aa8d894e70c113863d2006271dd2
4
+ data.tar.gz: 8a381fddeb0939c0e9633f1c5a978ea01238fcdf
5
5
  SHA512:
6
- metadata.gz: b83e3c0000f296d1379dc089c5396edc03576bb71c40337e3d8c723ec064365977c9e32482654f616d1cf58d70273b51fb454b4d3c69495c1423a7d23f6665c5
7
- data.tar.gz: 72096fa272b2d6094ca35600ac9adadee63f7b86235ba5b9238e1b14e70f5747b230d42d2d560cc7e4474af8c56cda129d4aefc6ea0e4861b4cd06d0dd2dc987
6
+ metadata.gz: 35884cac26ceb602327ff77abff5c7b6b520d8da22912c9479b1d980ab8bbe3e3e52227cfaa6dbf0bc2b0736bcdcc4277cbe012b7acc8ab9b370ef80dcaf40f2
7
+ data.tar.gz: a343992d6a73170f1baaeb3cc1dabac6c4a96785067508cc61d27802692c0d7904e8333a418565188cfa3a469e957fb58763b3f526dcd523c2d8ea5fa202d6e7
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- NOTE: In Development
1
+ # DS18B20
2
+
2
3
 
3
4
  [![Build Status](https://travis-ci.org/owaiswiz/ds18b20.svg?branch=master)](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
- In-development
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
 
@@ -3,7 +3,7 @@ module Ds18b20
3
3
  class Parser
4
4
 
5
5
  ERROR_READINGS = [85000,127687]
6
- MAXIMUM_RETRIES = 5
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
@@ -1,3 +1,3 @@
1
1
  module Ds18b20
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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