質問編集履歴
2
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -242,4 +242,4 @@
|
|
242
242
|
root@raspberrypi:/home/pi/senser#
|
243
243
|
```
|
244
244
|
consoleになにもでてきませんでした。(一応当たり前ですがif文を消したら0℃ 0%とでてきましたした。)
|
245
|
-
|
245
|
+
どこかまちがっているところがあればおしえてほしいです?
|
1
実際にやった事の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,7 +1,245 @@
|
|
1
1
|
ラズパイに配線したdht11から温度を計測したいのですが全く反応がありません。参考にさせていただいたサイトは下記です。
|
2
|
-
[Node.jsでのやり方](https://qiita.com/mochifuture/items/16085eca1d49ab9effaa)
|
2
|
+
[Node.jsでのやり方](https://qiita.com/mochifuture/items/16085eca1d49ab9effaa)
|
3
3
|
|
4
|
-
|
4
|
+
DHT11温湿度モジュール Temperature and humidity Sensor Module 使用
|
5
|
-
pythonの方も上に同じくconsoleになにもでませんでした
|
6
5
|
|
6
|
+
配線
|
7
|
+
Ground
|
8
|
+
GPIO 4
|
9
|
+
3.3v
|
10
|
+
|
11
|
+
nodeとnpmのバージョン
|
12
|
+
node 8.12.0
|
13
|
+
npm 6.4.1
|
14
|
+
|
15
|
+
ディレクトリ
|
16
|
+
/home/pi/senser/node_modules/node-dht-senser
|
17
|
+
ーーーーーーーーーdht.js
|
18
|
+
ーーーーーーーーーplugins/bcm2835-1.57
|
19
|
+
ーーーーーーーーーpackage.json
|
20
|
+
ーーーーーーーーー.. -lock.json
|
21
|
+
|
22
|
+
Node.jsで参考にしたサイトの通りにやってみました。logをはりつけていきたいと思います。
|
23
|
+
ディレクトリを作りbcm2835をraspbianにインストールしました
|
24
|
+
```
|
25
|
+
root@raspberrypi:/home/pi/senser/plugins# wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.57.tar.gz
|
26
|
+
--2018-11-24 10:41:47-- http://www.airspayce.com/mikem/bcm2835/bcm2835-1.57.tar.gz
|
27
|
+
www.airspayce.com (www.airspayce.com) をDNSに問いあわせています... 192.185.48.187
|
28
|
+
www.airspayce.com (www.airspayce.com)|192.185.48.187|:80 に接続しています... 接続しました。
|
29
|
+
HTTP による接続要求を送信しました、応答を待っています... 200 OK
|
30
|
+
長さ: 262227 (256K) [application/x-gzip]
|
31
|
+
`bcm2835-1.57.tar.gz' に保存中
|
32
|
+
|
33
|
+
bcm2835-1.57.tar.gz 100%[====================================================>] 256.08K 432KB/s in 0.6s
|
34
|
+
|
35
|
+
2018-11-24 10:41:48 (432 KB/s) - `bcm2835-1.57.tar.gz' へ保存完了 [262227/262227]
|
36
|
+
|
37
|
+
root@raspberrypi:/home/pi/senser/plugins# tar zxvf bcm2835-1.57.tar.gz
|
38
|
+
bcm2835-1.57/
|
39
|
+
bcm2835-1.57/configure.ac
|
40
|
+
・
|
41
|
+
・
|
42
|
+
・
|
43
|
+
bcm2835-1.57/doc/Makefile.am
|
44
|
+
bcm2835-1.57/test-driver
|
45
|
+
root@raspberrypi:/home/pi/senser/plugins# ^C
|
46
|
+
|
47
|
+
root@raspberrypi:/home/pi/senser/plugins# cd bcm2835-1.57
|
48
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# ./configure
|
49
|
+
checking for a BSD-compatible install... /usr/bin/install -c
|
50
|
+
checking whether build environment is sane... yes
|
51
|
+
checking for a thread-safe mkdir -p... /bin/mkdir -p
|
52
|
+
checking for gawk... no
|
53
|
+
checking for mawk... mawk・
|
54
|
+
・
|
55
|
+
・
|
56
|
+
・
|
57
|
+
config.status: creating config.h
|
58
|
+
config.status: executing depfiles commands
|
59
|
+
|
60
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# make
|
61
|
+
make all-recursive
|
62
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
63
|
+
Making all in src
|
64
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
65
|
+
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT bcm2835.o -MD -MP -MF .deps/bcm2835.Tpo -c -o bcm2835.o bcm2835.c
|
66
|
+
mv -f .deps/bcm2835.Tpo .deps/bcm2835.Po
|
67
|
+
rm -f libbcm2835.a
|
68
|
+
ar cru libbcm2835.a bcm2835.o
|
69
|
+
ar: `u' modifier ignored since `D' is the default (see `U')
|
70
|
+
ranlib libbcm2835.a
|
71
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
72
|
+
Making all in doc
|
73
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
74
|
+
make[2]: 'all' に対して行うべき事はありません.
|
75
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
76
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
77
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
78
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
79
|
+
|
80
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# make check
|
81
|
+
Making check in src
|
82
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
83
|
+
make test
|
84
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
85
|
+
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT test.o -MD -MP -MF .deps/test.Tpo -c -o test.o test.c
|
86
|
+
mv -f .deps/test.Tpo .deps/test.Po
|
87
|
+
gcc -g -O2 -o test test.o ./libbcm2835.a -lrt
|
88
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
89
|
+
make check-TESTS
|
90
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
91
|
+
make[3]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
92
|
+
PASS: test
|
93
|
+
============================================================================
|
94
|
+
Testsuite summary for bcm2835 1.57
|
95
|
+
============================================================================
|
96
|
+
# TOTAL: 1
|
97
|
+
# PASS: 1
|
98
|
+
# SKIP: 0
|
99
|
+
# XFAIL: 0
|
100
|
+
# FAIL: 0
|
101
|
+
# XPASS: 0
|
102
|
+
# ERROR: 0
|
103
|
+
============================================================================
|
104
|
+
make[3]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
105
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
106
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
107
|
+
Making check in doc
|
108
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
109
|
+
make[1]: 'check' に対して行うべき事はありません.
|
110
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
111
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
112
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
113
|
+
|
114
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# make install
|
115
|
+
Making install in src
|
116
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
117
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
118
|
+
/bin/mkdir -p '/usr/local/lib'
|
119
|
+
/usr/bin/install -c -m 644 libbcm2835.a '/usr/local/lib'
|
120
|
+
( cd '/usr/local/lib' && ranlib libbcm2835.a )
|
121
|
+
/bin/mkdir -p '/usr/local/include'
|
122
|
+
/usr/bin/install -c -m 644 bcm2835.h '/usr/local/include'
|
123
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
124
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
125
|
+
Making install in doc
|
126
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
127
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
128
|
+
make[2]: 'install-exec-am' に対して行うべき事はありません.
|
129
|
+
make[2]: 'install-data-am' に対して行うべき事はありません.
|
130
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
131
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
132
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
133
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
134
|
+
make[2]: 'install-exec-am' に対して行うべき事はありません.
|
135
|
+
make[2]: 'install-data-am' に対して行うべき事はありません.
|
136
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
137
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
138
|
+
```
|
139
|
+
node-dht-sensorのインストール
|
140
|
+
```ここに言語を入力
|
141
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# npm install -save-dev node-dht-sensor --dht_verbose=true --unsafe-perm
|
142
|
+
[..................] / rollbackFailedOptional: verb npm-session 1b0a8067189f5976
|
143
|
+
|
144
|
+
> node-dht-sensor@0.0.34 preinstall /home/pi/senser/node_modules/node-dht-sensor
|
145
|
+
> ./check-lib.sh
|
146
|
+
|
147
|
+
Library bcm2835 found.
|
148
|
+
|
149
|
+
> node-dht-sensor@0.0.34 install /home/pi/senser/node_modules/node-dht-sensor
|
150
|
+
> node-gyp configure
|
151
|
+
|
152
|
+
|
153
|
+
> node-dht-sensor@0.0.34 postinstall /home/pi/senser/node_modules/node-dht-sensor
|
154
|
+
> node-gyp build
|
155
|
+
|
156
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' に入ります
|
157
|
+
CXX(target) Release/obj.target/node_dht_sensor/node-dht-sensor.o
|
158
|
+
CXX(target) Release/obj.target/node_dht_sensor/dht-sensor.o
|
159
|
+
SOLINK_MODULE(target) Release/obj.target/node_dht_sensor.node
|
160
|
+
COPY Release/node_dht_sensor.node
|
161
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' から出ます
|
162
|
+
npm WARN node@1.0.0 No description
|
163
|
+
npm WARN node@1.0.0 No repository field.
|
164
|
+
|
165
|
+
+ node-dht-sensor@0.0.34
|
166
|
+
added 42 packages from 44 contributors and audited 84 packages in 16.882s
|
167
|
+
found 0 vulnerabilities
|
168
|
+
```
|
169
|
+
node-gypを使って、ダウンロードしたnode-dht-sensorをビルド
|
170
|
+
install
|
171
|
+
```ここに言語を入力
|
172
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# npm install node-gyp -g
|
173
|
+
/home/pi/.nvm/versions/node/v8.12.0/bin/node-gyp -> /home/pi/.nvm/versions/node/v8.12.0/lib/node_modules/node-gyp/bin/node-gyp.js
|
174
|
+
+ node-gyp@3.8.0
|
175
|
+
updated 1 package in 9.578s
|
176
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57#
|
177
|
+
|
178
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# cd /home/pi/senser/node_modules/node-dht-sensor
|
179
|
+
```
|
180
|
+
configure
|
181
|
+
```ここに言語を入力
|
182
|
+
root@raspberrypi:/home/pi/senser/node_modules/node-dht-sensor# node-gyp configure
|
183
|
+
gyp info it worked if it ends with ok
|
184
|
+
gyp info using node-gyp@3.8.0
|
185
|
+
gyp info using node@8.12.0 | linux | arm
|
186
|
+
gyp info spawn /usr/bin/python2
|
187
|
+
gyp info spawn args [ '/home/pi/.nvm/versions/node/v8.12.0/lib/node_modules/node-gyp/gyp/gyp_main.py',
|
188
|
+
gyp info spawn args 'binding.gyp',
|
189
|
+
gyp info spawn args '-f',
|
190
|
+
gyp info spawn args 'make',
|
191
|
+
gyp info spawn args '-I',
|
192
|
+
gyp info spawn args '/home/pi/senser/node_modules/node-dht-sensor/build/config.gypi',
|
193
|
+
gyp info spawn args '-I',
|
194
|
+
gyp info spawn args '/home/pi/.nvm/versions/node/v8.12.0/lib/node_modules/node-gyp/addon.gypi',
|
195
|
+
gyp info spawn args '-I',
|
196
|
+
gyp info spawn args '/root/.node-gyp/8.12.0/include/node/common.gypi',
|
197
|
+
gyp info spawn args '-Dlibrary=shared_library',
|
198
|
+
gyp info spawn args '-Dvisibility=default',
|
199
|
+
gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/8.12.0',
|
200
|
+
gyp info spawn args '-Dnode_gyp_dir=/home/pi/.nvm/versions/node/v8.12.0/lib/node_modules/node-gyp',
|
201
|
+
gyp info spawn args '-Dnode_lib_file=/root/.node-gyp/8.12.0/<(target_arch)/node.lib',
|
202
|
+
gyp info spawn args '-Dmodule_root_dir=/home/pi/senser/node_modules/node-dht-sensor',
|
203
|
+
gyp info spawn args '-Dnode_engine=v8',
|
204
|
+
gyp info spawn args '--depth=.',
|
205
|
+
gyp info spawn args '--no-parallel',
|
206
|
+
gyp info spawn args '--generator-output',
|
207
|
+
gyp info spawn args 'build',
|
208
|
+
gyp info spawn args '-Goutput_dir=.' ]
|
209
|
+
gyp info ok
|
210
|
+
```
|
211
|
+
build
|
212
|
+
```ここに言語を入力
|
213
|
+
root@raspberrypi:/home/pi/senser/node_modules/node-dht-sensor# node-gyp build
|
214
|
+
gyp info it worked if it ends with ok
|
215
|
+
gyp info using node-gyp@3.8.0
|
216
|
+
gyp info using node@8.12.0 | linux | arm
|
217
|
+
gyp info spawn make
|
218
|
+
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
|
219
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' に入ります
|
220
|
+
CXX(target) Release/obj.target/node_dht_sensor/node-dht-sensor.o
|
221
|
+
CXX(target) Release/obj.target/node_dht_sensor/dht-sensor.o
|
222
|
+
SOLINK_MODULE(target) Release/obj.target/node_dht_sensor.node
|
223
|
+
COPY Release/node_dht_sensor.node
|
224
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' から出ます
|
225
|
+
gyp info ok
|
226
|
+
```
|
227
|
+
プログラムの実行
|
228
|
+
```
|
229
|
+
//ファイル名dht.js
|
230
|
+
var sensor = require('node-dht-sensor');
|
231
|
+
|
232
|
+
sensor.read(11, 4, function(err, temperature, humidity) {
|
233
|
+
if (!err) {
|
234
|
+
console.log('temp: ' + temperature.toFixed(1) + '°C, ' +
|
235
|
+
'humidity: ' + humidity.toFixed(1) + '%'
|
236
|
+
);
|
237
|
+
}
|
238
|
+
});
|
239
|
+
|
240
|
+
実行後
|
241
|
+
root@raspberrypi:/home/pi/senser# node dht.js
|
242
|
+
root@raspberrypi:/home/pi/senser#
|
243
|
+
```
|
244
|
+
consoleになにもでてきませんでした。(一応当たり前ですがif文を消したら0℃ 0%とでてきましたした。)
|
7
|
-
|
245
|
+
原因は配線なのでしょうか?
|