rpi-dht 0.1.2 → 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/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/lib/rpi/dht.rb +7 -12
- data/lib/rpi/dht/version.rb +1 -1
- data/lib/rpi/environment.rb +13 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe5e8cd792201f1094254832ae8367bfec3fad932714971bbdb9559ed16d8cef
|
4
|
+
data.tar.gz: 5dbe7d166267e50d8fe65d9a8ce5f9ae054dd7d1f4a5677fef30b86efb4626af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cf85d4adf890c289a0f5bb29e930120f8b1dcfb290e75c37d4239a7a8977cd1a45bb2b542a034a439236d8cf66bb107bff7d7899fa577e767d9326b085572de
|
7
|
+
data.tar.gz: 07ef2d6c91d7193033d4d79eaff59b6bb5fe6ed0f2014e506c4f54ce1dba6771bef4425531fe1ac21ab4f7264d64b5c111381baae93222fe0eb10964b08fac96
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,13 @@ Or install it yourself as:
|
|
28
28
|
```rb
|
29
29
|
require "rpi/dht"
|
30
30
|
|
31
|
-
pin = 4
|
31
|
+
pin = 4 # bcm number https://i.gyazo.com/8de74c9e6a7139e30c2f540715a24dc9.png
|
32
|
+
|
33
|
+
####################
|
34
|
+
# GPIO numbering
|
35
|
+
####################
|
36
|
+
# RPi::Dht.set_numbering(:bcm) [default]
|
37
|
+
# or RPi::Dht.set_numbering(:board)
|
32
38
|
|
33
39
|
# Because it can't receive valid data from sensor reliably, there are methods try to read continusly until it gets valid data
|
34
40
|
# [read_11 and read_22] (without !) are recommended
|
data/lib/rpi/dht.rb
CHANGED
@@ -1,25 +1,20 @@
|
|
1
1
|
require "rpi/dht/version"
|
2
|
-
|
3
|
-
not `cat /proc/cpuinfo`.include?("Raspberry Pi")
|
4
|
-
end
|
5
|
-
|
6
|
-
if debug?
|
7
|
-
require "naught"
|
8
|
-
else
|
9
|
-
require "rpi_gpio"
|
10
|
-
RPi::GPIO.set_numbering :bcm
|
11
|
-
end
|
2
|
+
require "rpi/environment"
|
12
3
|
|
13
4
|
require "rpi/dht/base"
|
14
5
|
require "rpi/dht/dht11"
|
15
6
|
require "rpi/dht/dht22"
|
16
7
|
|
17
8
|
module RPi
|
18
|
-
GPIO = Naught.build(&:black_hole).new if debug?
|
19
|
-
|
20
9
|
module Dht
|
21
10
|
extend self
|
22
11
|
|
12
|
+
# https://i.gyazo.com/8de74c9e6a7139e30c2f540715a24dc9.png
|
13
|
+
def set_numbering(bcm_or_board = :bcm)
|
14
|
+
RPi::GPIO.set_numbering bcm_or_board.to_sym
|
15
|
+
end
|
16
|
+
set_numbering
|
17
|
+
|
23
18
|
def read_11!(pin)
|
24
19
|
Dht11.read!(pin)
|
25
20
|
end
|
data/lib/rpi/dht/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpi-dht
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- github0013
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- lib/rpi/dht/dht11.rb
|
145
145
|
- lib/rpi/dht/dht22.rb
|
146
146
|
- lib/rpi/dht/version.rb
|
147
|
+
- lib/rpi/environment.rb
|
147
148
|
- rpi-dht.gemspec
|
148
149
|
homepage: https://github.com/github0013/rpi-dht
|
149
150
|
licenses: []
|