- Go to https://nodejs.org and look for the current version of node.js. At this moment, for me version
9.5.0is the current version. - Open Terminal and Type
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -- Note: in future if you see the current version 10.x.x then in the URL above replace setup_9.x with
setup_10.x sudo apt-get install nodejssudo apt-get install npmsudo npm i -g npm- In order for some npm packages to work (such as those that require building from source), you will need to install the build-essentials package.
sudo apt-get install build-essential
- Go to : http://www.airspayce.com/mikem/bcm2835 and check for the latest version of the library. For me it is
bcm2835-1.55now. - Open Terminal and type:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.55.tar.gz tar zxvf bcm2835-1.55.tar.gz: This will unzip this file.cd bcm2835-1.55: Go to this directory./configuremakesudo make checksudo make install
- To install git on your Raspberry Pi, open terminal and Type:
sudo apt-get install git-core
git clone https://github.com/apal21/Raspberry-Pi-DHT11-Node.jscd Raspberry-Pi-DHT11-Node.jsnpm installnode index.jsornpm run test
mkdir DHT11 && cd DHT11npm init --yesnano index.jsand paste the content of this repo's index.js file.npm install node-dht-sensornode index.js