質問編集履歴
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -486,4 +486,4 @@
|
|
486
486
|
|
487
487
|
consoleになにもでてきませんでした。(一応当たり前ですがif文を消したら0℃ 0%とでてきましたした。)
|
488
488
|
|
489
|
-
|
489
|
+
どこかまちがっているところがあればおしえてほしいです?
|
1
実際にやった事の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,13 +1,489 @@
|
|
1
1
|
ラズパイに配線したdht11から温度を計測したいのですが全く反応がありません。参考にさせていただいたサイトは下記です。
|
2
2
|
|
3
|
-
[Node.jsでのやり方](https://qiita.com/mochifuture/items/16085eca1d49ab9effaa)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
[Node.jsでのやり方](https://qiita.com/mochifuture/items/16085eca1d49ab9effaa)
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
DHT11温湿度モジュール Temperature and humidity Sensor Module 使用
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
配線
|
12
|
+
|
13
|
+
Ground
|
14
|
+
|
15
|
+
GPIO 4
|
16
|
+
|
17
|
+
3.3v
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
nodeとnpmのバージョン
|
22
|
+
|
23
|
+
node 8.12.0
|
24
|
+
|
25
|
+
npm 6.4.1
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
ディレクトリ
|
30
|
+
|
31
|
+
/home/pi/senser/node_modules/node-dht-senser
|
32
|
+
|
33
|
+
ーーーーーーーーーdht.js
|
34
|
+
|
35
|
+
ーーーーーーーーーplugins/bcm2835-1.57
|
36
|
+
|
37
|
+
ーーーーーーーーーpackage.json
|
38
|
+
|
39
|
+
ーーーーーーーーー.. -lock.json
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
Node.jsで参考にしたサイトの通りにやってみました。logをはりつけていきたいと思います。
|
44
|
+
|
45
|
+
ディレクトリを作りbcm2835をraspbianにインストールしました
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
root@raspberrypi:/home/pi/senser/plugins# wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.57.tar.gz
|
50
|
+
|
51
|
+
--2018-11-24 10:41:47-- http://www.airspayce.com/mikem/bcm2835/bcm2835-1.57.tar.gz
|
52
|
+
|
53
|
+
www.airspayce.com (www.airspayce.com) をDNSに問いあわせています... 192.185.48.187
|
54
|
+
|
55
|
+
www.airspayce.com (www.airspayce.com)|192.185.48.187|:80 に接続しています... 接続しました。
|
56
|
+
|
57
|
+
HTTP による接続要求を送信しました、応答を待っています... 200 OK
|
58
|
+
|
59
|
+
長さ: 262227 (256K) [application/x-gzip]
|
60
|
+
|
61
|
+
`bcm2835-1.57.tar.gz' に保存中
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
bcm2835-1.57.tar.gz 100%[====================================================>] 256.08K 432KB/s in 0.6s
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
2018-11-24 10:41:48 (432 KB/s) - `bcm2835-1.57.tar.gz' へ保存完了 [262227/262227]
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
root@raspberrypi:/home/pi/senser/plugins# tar zxvf bcm2835-1.57.tar.gz
|
74
|
+
|
75
|
+
bcm2835-1.57/
|
76
|
+
|
77
|
+
bcm2835-1.57/configure.ac
|
78
|
+
|
79
|
+
・
|
80
|
+
|
81
|
+
・
|
82
|
+
|
83
|
+
・
|
84
|
+
|
85
|
+
bcm2835-1.57/doc/Makefile.am
|
86
|
+
|
87
|
+
bcm2835-1.57/test-driver
|
88
|
+
|
89
|
+
root@raspberrypi:/home/pi/senser/plugins# ^C
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
root@raspberrypi:/home/pi/senser/plugins# cd bcm2835-1.57
|
94
|
+
|
95
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# ./configure
|
96
|
+
|
97
|
+
checking for a BSD-compatible install... /usr/bin/install -c
|
98
|
+
|
99
|
+
checking whether build environment is sane... yes
|
100
|
+
|
101
|
+
checking for a thread-safe mkdir -p... /bin/mkdir -p
|
102
|
+
|
103
|
+
checking for gawk... no
|
104
|
+
|
105
|
+
checking for mawk... mawk・
|
106
|
+
|
107
|
+
・
|
108
|
+
|
109
|
+
・
|
110
|
+
|
111
|
+
・
|
112
|
+
|
113
|
+
config.status: creating config.h
|
114
|
+
|
115
|
+
config.status: executing depfiles commands
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# make
|
120
|
+
|
121
|
+
make all-recursive
|
122
|
+
|
123
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
124
|
+
|
125
|
+
Making all in src
|
126
|
+
|
127
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
128
|
+
|
129
|
+
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT bcm2835.o -MD -MP -MF .deps/bcm2835.Tpo -c -o bcm2835.o bcm2835.c
|
130
|
+
|
131
|
+
mv -f .deps/bcm2835.Tpo .deps/bcm2835.Po
|
132
|
+
|
133
|
+
rm -f libbcm2835.a
|
134
|
+
|
135
|
+
ar cru libbcm2835.a bcm2835.o
|
136
|
+
|
137
|
+
ar: `u' modifier ignored since `D' is the default (see `U')
|
138
|
+
|
139
|
+
ranlib libbcm2835.a
|
140
|
+
|
141
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
142
|
+
|
143
|
+
Making all in doc
|
144
|
+
|
145
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
146
|
+
|
147
|
+
make[2]: 'all' に対して行うべき事はありません.
|
148
|
+
|
149
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
150
|
+
|
151
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
152
|
+
|
153
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
154
|
+
|
155
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# make check
|
160
|
+
|
161
|
+
Making check in src
|
162
|
+
|
163
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
164
|
+
|
165
|
+
make test
|
166
|
+
|
167
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
168
|
+
|
169
|
+
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT test.o -MD -MP -MF .deps/test.Tpo -c -o test.o test.c
|
170
|
+
|
171
|
+
mv -f .deps/test.Tpo .deps/test.Po
|
172
|
+
|
173
|
+
gcc -g -O2 -o test test.o ./libbcm2835.a -lrt
|
174
|
+
|
175
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
176
|
+
|
177
|
+
make check-TESTS
|
178
|
+
|
179
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
180
|
+
|
181
|
+
make[3]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
182
|
+
|
183
|
+
PASS: test
|
184
|
+
|
185
|
+
============================================================================
|
186
|
+
|
187
|
+
Testsuite summary for bcm2835 1.57
|
188
|
+
|
189
|
+
============================================================================
|
190
|
+
|
191
|
+
# TOTAL: 1
|
192
|
+
|
193
|
+
# PASS: 1
|
194
|
+
|
195
|
+
# SKIP: 0
|
196
|
+
|
197
|
+
# XFAIL: 0
|
198
|
+
|
199
|
+
# FAIL: 0
|
200
|
+
|
201
|
+
# XPASS: 0
|
202
|
+
|
203
|
+
# ERROR: 0
|
204
|
+
|
205
|
+
============================================================================
|
206
|
+
|
207
|
+
make[3]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
208
|
+
|
209
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
210
|
+
|
211
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
212
|
+
|
213
|
+
Making check in doc
|
214
|
+
|
215
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
216
|
+
|
217
|
+
make[1]: 'check' に対して行うべき事はありません.
|
218
|
+
|
219
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
220
|
+
|
221
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
222
|
+
|
223
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# make install
|
228
|
+
|
229
|
+
Making install in src
|
230
|
+
|
231
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
232
|
+
|
233
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' に入ります
|
234
|
+
|
235
|
+
/bin/mkdir -p '/usr/local/lib'
|
236
|
+
|
237
|
+
/usr/bin/install -c -m 644 libbcm2835.a '/usr/local/lib'
|
238
|
+
|
239
|
+
( cd '/usr/local/lib' && ranlib libbcm2835.a )
|
240
|
+
|
241
|
+
/bin/mkdir -p '/usr/local/include'
|
242
|
+
|
243
|
+
/usr/bin/install -c -m 644 bcm2835.h '/usr/local/include'
|
244
|
+
|
245
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
246
|
+
|
247
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/src' から出ます
|
248
|
+
|
249
|
+
Making install in doc
|
250
|
+
|
251
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
252
|
+
|
253
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' に入ります
|
254
|
+
|
255
|
+
make[2]: 'install-exec-am' に対して行うべき事はありません.
|
256
|
+
|
257
|
+
make[2]: 'install-data-am' に対して行うべき事はありません.
|
258
|
+
|
259
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
260
|
+
|
261
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57/doc' から出ます
|
262
|
+
|
263
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
264
|
+
|
265
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' に入ります
|
266
|
+
|
267
|
+
make[2]: 'install-exec-am' に対して行うべき事はありません.
|
268
|
+
|
269
|
+
make[2]: 'install-data-am' に対して行うべき事はありません.
|
270
|
+
|
271
|
+
make[2]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
272
|
+
|
273
|
+
make[1]: ディレクトリ '/home/pi/senser/plugins/bcm2835-1.57' から出ます
|
274
|
+
|
275
|
+
```
|
276
|
+
|
277
|
+
node-dht-sensorのインストール
|
278
|
+
|
279
|
+
```ここに言語を入力
|
280
|
+
|
281
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# npm install -save-dev node-dht-sensor --dht_verbose=true --unsafe-perm
|
282
|
+
|
283
|
+
[..................] / rollbackFailedOptional: verb npm-session 1b0a8067189f5976
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
> node-dht-sensor@0.0.34 preinstall /home/pi/senser/node_modules/node-dht-sensor
|
288
|
+
|
289
|
+
> ./check-lib.sh
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
Library bcm2835 found.
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
> node-dht-sensor@0.0.34 install /home/pi/senser/node_modules/node-dht-sensor
|
298
|
+
|
299
|
+
> node-gyp configure
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
> node-dht-sensor@0.0.34 postinstall /home/pi/senser/node_modules/node-dht-sensor
|
306
|
+
|
307
|
+
> node-gyp build
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' に入ります
|
312
|
+
|
313
|
+
CXX(target) Release/obj.target/node_dht_sensor/node-dht-sensor.o
|
314
|
+
|
315
|
+
CXX(target) Release/obj.target/node_dht_sensor/dht-sensor.o
|
316
|
+
|
317
|
+
SOLINK_MODULE(target) Release/obj.target/node_dht_sensor.node
|
318
|
+
|
319
|
+
COPY Release/node_dht_sensor.node
|
320
|
+
|
321
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' から出ます
|
322
|
+
|
323
|
+
npm WARN node@1.0.0 No description
|
324
|
+
|
325
|
+
npm WARN node@1.0.0 No repository field.
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
+ node-dht-sensor@0.0.34
|
330
|
+
|
331
|
+
added 42 packages from 44 contributors and audited 84 packages in 16.882s
|
332
|
+
|
333
|
+
found 0 vulnerabilities
|
334
|
+
|
335
|
+
```
|
336
|
+
|
337
|
+
node-gypを使って、ダウンロードしたnode-dht-sensorをビルド
|
338
|
+
|
339
|
+
install
|
340
|
+
|
341
|
+
```ここに言語を入力
|
342
|
+
|
343
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# npm install node-gyp -g
|
344
|
+
|
345
|
+
/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
|
346
|
+
|
347
|
+
+ node-gyp@3.8.0
|
348
|
+
|
349
|
+
updated 1 package in 9.578s
|
350
|
+
|
351
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57#
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
root@raspberrypi:/home/pi/senser/plugins/bcm2835-1.57# cd /home/pi/senser/node_modules/node-dht-sensor
|
356
|
+
|
357
|
+
```
|
358
|
+
|
359
|
+
configure
|
360
|
+
|
361
|
+
```ここに言語を入力
|
362
|
+
|
363
|
+
root@raspberrypi:/home/pi/senser/node_modules/node-dht-sensor# node-gyp configure
|
364
|
+
|
365
|
+
gyp info it worked if it ends with ok
|
366
|
+
|
367
|
+
gyp info using node-gyp@3.8.0
|
368
|
+
|
369
|
+
gyp info using node@8.12.0 | linux | arm
|
370
|
+
|
371
|
+
gyp info spawn /usr/bin/python2
|
372
|
+
|
373
|
+
gyp info spawn args [ '/home/pi/.nvm/versions/node/v8.12.0/lib/node_modules/node-gyp/gyp/gyp_main.py',
|
374
|
+
|
375
|
+
gyp info spawn args 'binding.gyp',
|
376
|
+
|
377
|
+
gyp info spawn args '-f',
|
378
|
+
|
379
|
+
gyp info spawn args 'make',
|
380
|
+
|
381
|
+
gyp info spawn args '-I',
|
382
|
+
|
383
|
+
gyp info spawn args '/home/pi/senser/node_modules/node-dht-sensor/build/config.gypi',
|
384
|
+
|
385
|
+
gyp info spawn args '-I',
|
386
|
+
|
387
|
+
gyp info spawn args '/home/pi/.nvm/versions/node/v8.12.0/lib/node_modules/node-gyp/addon.gypi',
|
388
|
+
|
389
|
+
gyp info spawn args '-I',
|
390
|
+
|
391
|
+
gyp info spawn args '/root/.node-gyp/8.12.0/include/node/common.gypi',
|
392
|
+
|
393
|
+
gyp info spawn args '-Dlibrary=shared_library',
|
394
|
+
|
395
|
+
gyp info spawn args '-Dvisibility=default',
|
396
|
+
|
397
|
+
gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/8.12.0',
|
398
|
+
|
399
|
+
gyp info spawn args '-Dnode_gyp_dir=/home/pi/.nvm/versions/node/v8.12.0/lib/node_modules/node-gyp',
|
400
|
+
|
401
|
+
gyp info spawn args '-Dnode_lib_file=/root/.node-gyp/8.12.0/<(target_arch)/node.lib',
|
402
|
+
|
403
|
+
gyp info spawn args '-Dmodule_root_dir=/home/pi/senser/node_modules/node-dht-sensor',
|
404
|
+
|
405
|
+
gyp info spawn args '-Dnode_engine=v8',
|
406
|
+
|
407
|
+
gyp info spawn args '--depth=.',
|
408
|
+
|
409
|
+
gyp info spawn args '--no-parallel',
|
410
|
+
|
411
|
+
gyp info spawn args '--generator-output',
|
412
|
+
|
413
|
+
gyp info spawn args 'build',
|
414
|
+
|
415
|
+
gyp info spawn args '-Goutput_dir=.' ]
|
416
|
+
|
417
|
+
gyp info ok
|
418
|
+
|
419
|
+
```
|
420
|
+
|
421
|
+
build
|
422
|
+
|
423
|
+
```ここに言語を入力
|
424
|
+
|
425
|
+
root@raspberrypi:/home/pi/senser/node_modules/node-dht-sensor# node-gyp build
|
426
|
+
|
427
|
+
gyp info it worked if it ends with ok
|
428
|
+
|
429
|
+
gyp info using node-gyp@3.8.0
|
430
|
+
|
431
|
+
gyp info using node@8.12.0 | linux | arm
|
432
|
+
|
433
|
+
gyp info spawn make
|
434
|
+
|
435
|
+
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
|
436
|
+
|
437
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' に入ります
|
438
|
+
|
439
|
+
CXX(target) Release/obj.target/node_dht_sensor/node-dht-sensor.o
|
440
|
+
|
441
|
+
CXX(target) Release/obj.target/node_dht_sensor/dht-sensor.o
|
442
|
+
|
443
|
+
SOLINK_MODULE(target) Release/obj.target/node_dht_sensor.node
|
444
|
+
|
445
|
+
COPY Release/node_dht_sensor.node
|
446
|
+
|
447
|
+
make: ディレクトリ '/home/pi/senser/node_modules/node-dht-sensor/build' から出ます
|
448
|
+
|
449
|
+
gyp info ok
|
450
|
+
|
451
|
+
```
|
452
|
+
|
453
|
+
プログラムの実行
|
454
|
+
|
455
|
+
```
|
456
|
+
|
457
|
+
//ファイル名dht.js
|
458
|
+
|
459
|
+
var sensor = require('node-dht-sensor');
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
sensor.read(11, 4, function(err, temperature, humidity) {
|
464
|
+
|
465
|
+
if (!err) {
|
466
|
+
|
467
|
+
console.log('temp: ' + temperature.toFixed(1) + '°C, ' +
|
468
|
+
|
469
|
+
'humidity: ' + humidity.toFixed(1) + '%'
|
470
|
+
|
471
|
+
);
|
472
|
+
|
473
|
+
}
|
474
|
+
|
475
|
+
});
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
実行後
|
480
|
+
|
481
|
+
root@raspberrypi:/home/pi/senser# node dht.js
|
482
|
+
|
483
|
+
root@raspberrypi:/home/pi/senser#
|
484
|
+
|
485
|
+
```
|
486
|
+
|
487
|
+
consoleになにもでてきませんでした。(一応当たり前ですがif文を消したら0℃ 0%とでてきましたした。)
|
488
|
+
|
489
|
+
原因は配線なのでしょうか?
|