Skip to content
guccio7 edited this page Apr 28, 2017 · 5 revisions

Welcome to the DHT11 wiki! http://qiita.com/setouchi/items/437e4b62e4210871496f

nodejsとnpmをインストールします。 sudo apt-get install -y nodejs npm

pi@raspberrypi:~ $ sudo npm cache clean pi@raspberrypi:~ $ sudo npm install n -g /usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n n@2.1.7 /usr/local/lib/node_modules/n pi@raspberrypi:~ $ sudo n stable

 `install : node-v7.8.0`
   `mkdir : /usr/local/n/versions/node/7.8.0`
   `fetch : https://nodejs.org/dist/v7.8.0/node-v7.8.0-linux-armv6l.tar.gz`

######################################################################## 100.0% installed : v7.8.0

pi@raspberrypi:~ $ node -v v7.8.0

pi@raspberrypi:~ $ npm install node-dht-sensor

> node-dht-sensor@0.0.32 preinstall /home/pi/node_modules/.staging/node-dht-sensor-cfd4dcc2 > ./check-lib.sh

+--------------------------------------------------------------------------------+ | ERROR: Library BCM2835 not found! | | Make sure you follow instructions from http://www.airspayce.com/mikem/bcm2835/ | | to install the BCM2835 library on your system first then install this addon. | +--------------------------------------------------------------------------------+

pi@raspberrypi:~/Downloads $ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz --2017-04-28 15:19:43-- http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz Resolving www.airspayce.com (www.airspayce.com)... 192.185.48.187 Connecting to www.airspayce.com (www.airspayce.com)|192.185.48.187|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 258007 (252K) [application/x-gzip] Saving to: ‘bcm2835-1.52.tar.gz’

bcm2835-1.52.tar.gz 100%[==========================>] 251.96K 191KB/s in 1.3s

2017-04-28 15:19:45 (191 KB/s) - ‘bcm2835-1.52.tar.gz’ saved [258007/258007]

pi@raspberrypi:~/Downloads $ ls bcm2835-1.52.tar.gz Raspberry_Pi_Education_Manual.pdf pi@raspberrypi:~/Downloads $ tar xvfz ./bcm2835-1.52.tar.gz bcm2835-1.52/ bcm2835-1.52/configure.ac bcm2835-1.52/COPYING bcm2835-1.52/examples/ bcm2835-1.52/examples/spi/ bcm2835-1.52/examples/spi/spi.c bcm2835-1.52/examples/input/ bcm2835-1.52/examples/input/input.c bcm2835-1.52/examples/event/ bcm2835-1.52/examples/event/event.c bcm2835-1.52/examples/pwm/ bcm2835-1.52/examples/pwm/pwm.c bcm2835-1.52/examples/gpio/ bcm2835-1.52/examples/gpio/gpio.c bcm2835-1.52/examples/blink/ bcm2835-1.52/examples/blink/blink.c bcm2835-1.52/examples/spin/ bcm2835-1.52/examples/spin/spin.c bcm2835-1.52/examples/i2c/ bcm2835-1.52/examples/i2c/i2c.c bcm2835-1.52/config.guess bcm2835-1.52/NEWS bcm2835-1.52/depcomp bcm2835-1.52/configure bcm2835-1.52/aclocal.m4 bcm2835-1.52/compile bcm2835-1.52/INSTALL bcm2835-1.52/Makefile.in bcm2835-1.52/missing bcm2835-1.52/config.sub bcm2835-1.52/Makefile.am bcm2835-1.52/ChangeLog bcm2835-1.52/README bcm2835-1.52/install-sh bcm2835-1.52/config.h.in bcm2835-1.52/src/ bcm2835-1.52/src/test.c bcm2835-1.52/src/bcm2835.h bcm2835-1.52/src/bcm2835.c bcm2835-1.52/src/Makefile.in bcm2835-1.52/src/Makefile.am bcm2835-1.52/ltmain.sh bcm2835-1.52/AUTHORS bcm2835-1.52/doc/ bcm2835-1.52/doc/Doxyfile.in bcm2835-1.52/doc/Makefile.in bcm2835-1.52/doc/Makefile.am bcm2835-1.52/test-driver pi@raspberrypi:~/Downloads $ ls bcm2835-1.52 bcm2835-1.52.tar.gz Raspberry_Pi_Education_Manual.pdf pi@raspberrypi:~/Downloads $ cd bcm2835-1.52/ pi@raspberrypi:~/Downloads/bcm2835-1.52 $ ls aclocal.m4 config.guess configure.ac examples Makefile.am README AUTHORS config.h.in COPYING INSTALL Makefile.in src ChangeLog config.sub depcomp install-sh missing test-driver compile configure doc ltmain.sh NEWS pi@raspberrypi:~/Downloads/bcm2835-1.52 $ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for clock_gettime in -lrt... yes checking for doxygen... no configure: WARNING: Doxygen not found - continuing without Doxygen support checking for ranlib... ranlib checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking whether gcc understands -c and -o together... (cached) yes checking dependency style of gcc... (cached) gcc3 checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating doc/Makefile config.status: creating config.h config.status: executing depfiles commands pi@raspberrypi:~/Downloads/bcm2835-1.52 $ make make all-recursive make[1]: Entering directory '/home/pi/Downloads/bcm2835-1.52' Making all in src make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52/src' gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT bcm2835.o -MD -MP -MF .deps/bcm2835.Tpo -c -o bcm2835.o bcm2835.c mv -f .deps/bcm2835.Tpo .deps/bcm2835.Po rm -f libbcm2835.a ar cru libbcm2835.a bcm2835.o ranlib libbcm2835.a make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/src' Making all in doc make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52/doc' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/doc' make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52' make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52' make[1]: Leaving directory '/home/pi/Downloads/bcm2835-1.52' pi@raspberrypi:~/Downloads/bcm2835-1.52 $ sudo make check Making check in src make[1]: Entering directory '/home/pi/Downloads/bcm2835-1.52/src' make test make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52/src' gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT test.o -MD -MP -MF .deps/test.Tpo -c -o test.o test.c mv -f .deps/test.Tpo .deps/test.Po gcc -g -O2 -o test test.o ./libbcm2835.a -lrt make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/src' make check-TESTS make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52/src' make[3]: Entering directory '/home/pi/Downloads/bcm2835-1.52/src' PASS: test ============================================================================ Testsuite summary for bcm2835 1.52 ============================================================================ # TOTAL: 1 # PASS: 1 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ make[3]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/src' make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/src' make[1]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/src' Making check in doc make[1]: Entering directory '/home/pi/Downloads/bcm2835-1.52/doc' make[1]: Nothing to be done for 'check'. make[1]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/doc' make[1]: Entering directory '/home/pi/Downloads/bcm2835-1.52' make[1]: Leaving directory '/home/pi/Downloads/bcm2835-1.52' pi@raspberrypi:~/Downloads/bcm2835-1.52 $ sudo make install Making install in src make[1]: Entering directory '/home/pi/Downloads/bcm2835-1.52/src' make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52/src' /bin/mkdir -p '/usr/local/lib' /usr/bin/install -c -m 644 libbcm2835.a '/usr/local/lib' ( cd '/usr/local/lib' && ranlib libbcm2835.a ) /bin/mkdir -p '/usr/local/include' /usr/bin/install -c -m 644 bcm2835.h '/usr/local/include' make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/src' make[1]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/src' Making install in doc make[1]: Entering directory '/home/pi/Downloads/bcm2835-1.52/doc' make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52/doc' make[2]: Nothing to be done for 'install-exec-am'. make[2]: Nothing to be done for 'install-data-am'. make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/doc' make[1]: Leaving directory '/home/pi/Downloads/bcm2835-1.52/doc' make[1]: Entering directory '/home/pi/Downloads/bcm2835-1.52' make[2]: Entering directory '/home/pi/Downloads/bcm2835-1.52' make[2]: Nothing to be done for 'install-exec-am'. make[2]: Nothing to be done for 'install-data-am'. make[2]: Leaving directory '/home/pi/Downloads/bcm2835-1.52' make[1]: Leaving directory '/home/pi/Downloads/bcm2835-1.52' pi@raspberrypi:~/Downloads/bcm2835-1.52 $

pi@raspberrypi:~/Downloads/bcm2835-1.52 $ npm install node-dht-sensor

> node-dht-sensor@0.0.32 preinstall /home/pi/Downloads/bcm2835-1.52/node_modules/.staging/node-dht-sensor-345ceccb > ./check-lib.sh

Library bcm2835 found.

> node-dht-sensor@0.0.32 install /home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor > node-gyp configure

> node-dht-sensor@0.0.32 postinstall /home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor > node-gyp build

make: Entering directory '/home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor/build' CXX(target) Release/obj.target/node_dht_sensor/node-dht-sensor.o CXX(target) Release/obj.target/node_dht_sensor/dht-sensor.o SOLINK_MODULE(target) Release/obj.target/node_dht_sensor.node COPY Release/node_dht_sensor.node make: Leaving directory '/home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor/build' /home/pi/Downloads/bcm2835-1.52 └── node-dht-sensor@0.0.32

npm WARN enoent ENOENT: no such file or directory, open '/home/pi/Downloads/bcm2835-1.52/package.json' npm WARN bcm2835-1.52 No description npm WARN bcm2835-1.52 No repository field. npm WARN bcm2835-1.52 No README data npm WARN bcm2835-1.52 No license field.

pi@raspberrypi:~/Downloads/bcm2835-1.52 $ sudo npm install node-gyp -g /usr/local/bin/node-gyp -> /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js /usr/local/lib └─┬ node-gyp@3.6.0 ├─┬ fstream@1.0.11 │ └── inherits@2.0.3 ├─┬ glob@7.1.1 │ ├── fs.realpath@1.0.0 │ ├─┬ inflight@1.0.6 │ │ └── wrappy@1.0.2 │ ├── once@1.4.0 │ └── path-is-absolute@1.0.1 ├── graceful-fs@4.1.11 ├─┬ minimatch@3.0.3 │ └─┬ brace-expansion@1.1.7 │ ├── balanced-match@0.4.2 │ └── concat-map@0.0.1 ├─┬ mkdirp@0.5.1 │ └── minimist@0.0.8 ├─┬ nopt@3.0.6 │ └── abbrev@1.1.0 ├─┬ npmlog@4.0.2 │ ├─┬ are-we-there-yet@1.1.4 │ │ ├── delegates@1.0.0 │ │ └─┬ readable-stream@2.2.9 │ │ ├── buffer-shims@1.0.0 │ │ ├── core-util-is@1.0.2 │ │ ├── isarray@1.0.0 │ │ ├── process-nextick-args@1.0.7 │ │ ├── string_decoder@1.0.0 │ │ └── util-deprecate@1.0.2 │ ├── console-control-strings@1.1.0 │ ├─┬ gauge@2.7.4 │ │ ├── aproba@1.1.1 │ │ ├── has-unicode@2.0.1 │ │ ├── object-assign@4.1.1 │ │ ├── signal-exit@3.0.2 │ │ ├─┬ string-width@1.0.2 │ │ │ ├── code-point-at@1.1.0 │ │ │ └─┬ is-fullwidth-code-point@1.0.0 │ │ │ └── number-is-nan@1.0.1 │ │ ├─┬ strip-ansi@3.0.1 │ │ │ └── ansi-regex@2.1.1 │ │ └── wide-align@1.1.0 │ └── set-blocking@2.0.0 ├─┬ osenv@0.1.4 │ ├── os-homedir@1.0.2 │ └── os-tmpdir@1.0.2 ├─┬ request@2.81.0 │ ├── aws-sign2@0.6.0 │ ├── aws4@1.6.0 │ ├── caseless@0.12.0 │ ├─┬ combined-stream@1.0.5 │ │ └── delayed-stream@1.0.0 │ ├── extend@3.0.1 │ ├── forever-agent@0.6.1 │ ├─┬ form-data@2.1.4 │ │ └── asynckit@0.4.0 │ ├─┬ har-validator@4.2.1 │ │ ├─┬ ajv@4.11.7 │ │ │ ├── co@4.6.0 │ │ │ └─┬ json-stable-stringify@1.0.1 │ │ │ └── jsonify@0.0.0 │ │ └── har-schema@1.0.5 │ ├─┬ hawk@3.1.3 │ │ ├── boom@2.10.1 │ │ ├── cryptiles@2.0.5 │ │ ├── hoek@2.16.3 │ │ └── sntp@1.0.9 │ ├─┬ http-signature@1.1.1 │ │ ├── assert-plus@0.2.0 │ │ ├─┬ jsprim@1.4.0 │ │ │ ├── assert-plus@1.0.0 │ │ │ ├── extsprintf@1.0.2 │ │ │ ├── json-schema@0.2.3 │ │ │ └── verror@1.3.6 │ │ └─┬ sshpk@1.13.0 │ │ ├── asn1@0.2.3 │ │ ├── assert-plus@1.0.0 │ │ ├── bcrypt-pbkdf@1.0.1 │ │ ├─┬ dashdash@1.14.1 │ │ │ └── assert-plus@1.0.0 │ │ ├── ecc-jsbn@0.1.1 │ │ ├─┬ getpass@0.1.7 │ │ │ └── assert-plus@1.0.0 │ │ ├── jodid25519@1.0.2 │ │ ├── jsbn@0.1.1 │ │ └── tweetnacl@0.14.5 │ ├── is-typedarray@1.0.0 │ ├── isstream@0.1.2 │ ├── json-stringify-safe@5.0.1 │ ├─┬ mime-types@2.1.15 │ │ └── mime-db@1.27.0 │ ├── oauth-sign@0.8.2 │ ├── performance-now@0.2.0 │ ├── qs@6.4.0 │ ├── safe-buffer@5.0.1 │ ├── stringstream@0.0.5 │ ├─┬ tough-cookie@2.3.2 │ │ └── punycode@1.4.1 │ ├── tunnel-agent@0.6.0 │ └── uuid@3.0.1 ├── rimraf@2.6.1 ├── semver@5.3.0 ├─┬ tar@2.2.1 │ └── block-stream@0.0.9 └─┬ which@1.2.14 └── isexe@2.0.0

pi@raspberrypi:~/Downloads/bcm2835-1.52/node_modules $ ls abbrev fstream number-is-nan ajv fstream-ignore oauth-sign ansi-regex gauge object-assign aproba getpass once are-we-there-yet glob path-is-absolute asn1 graceful-fs performance-now assert-plus har-schema process-nextick-args asynckit har-validator punycode aws4 has-unicode qs aws-sign2 hawk rc balanced-match hoek readable-stream bcrypt http-signature request bcrypt-pbkdf inflight rimraf bindings inherits safe-buffer block-stream ini semver boom isarray set-blocking brace-expansion is-fullwidth-code-point signal-exit buffer-shims isstream sntp caseless is-typedarray sshpk co jodid25519 string_decoder code-point-at jsbn stringstream combined-stream jsonify string-width concat-map json-schema strip-ansi console-control-strings json-stable-stringify strip-json-comments core-util-is json-stringify-safe tar cryptiles jsprim tar-pack dashdash mime-db tough-cookie debug mime-types tunnel-agent deep-extend minimatch tweetnacl delayed-stream minimist uid-number delegates mkdirp util-deprecate ecc-jsbn ms uuid extend nan verror extsprintf node-dht-sensor wide-align forever-agent node-pre-gyp wrappy form-data nopt fs.realpath npmlog pi@raspberrypi:~/Downloads/bcm2835-1.52/node_modules $ cd node-dht-sensor/ pi@raspberrypi:~/Downloads/bcm2835-1.52/node_modules/node-dht-sensor $ ls binding.gyp check-lib.sh dht-sensor.h node-dht-sensor.cpp README.md build dht-sensor.cpp LICENSE package.json test pi@raspberrypi:~/Downloads/bcm2835-1.52/node_modules/node-dht-sensor $ pwd /home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor pi@raspberrypi:~/Downloads/bcm2835-1.52/node_modules/node-dht-sensor $ ls binding.gyp check-lib.sh dht-sensor.h node-dht-sensor.cpp README.md build dht-sensor.cpp LICENSE package.json test pi@raspberrypi:~/Downloads/bcm2835-1.52/node_modules/node-dht-sensor $ node-gyp configure gyp info it worked if it ends with ok gyp info using node-gyp@3.6.0 gyp info using node@7.8.0 | linux | arm gyp info spawn /usr/bin/python2 gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/home/pi/.node-gyp/7.8.0/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/home/pi/.node-gyp/7.8.0', gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=node.lib', gyp info spawn args '-Dmodule_root_dir=/home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp info ok pi@raspberrypi:~/Downloads/bcm2835-1.52/node_modules/node-dht-sensor $ node-gyp build gyp info it worked if it ends with ok gyp info using node-gyp@3.6.0 gyp info using node@7.8.0 | linux | arm gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] make: Entering directory '/home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor/build' make: Nothing to be done for 'all'. make: Leaving directory '/home/pi/Downloads/bcm2835-1.52/node_modules/node-dht-sensor/build' gyp info ok

Clone this wiki locally