August 2017
Intermediate to advanced
214 pages
4h 31m
English
Now that everything's connected, let's take a reading from our sensor. The DHT11 sensor gives us a 40-bit reading over the time span of 2 seconds. Timing and reading each bit can be a complex task. Fortunately for us, there are libraries present to make our lives easier.
Node.js does not have the required support for the DHT11 sensor, and we need to install the bcm2835 library in order to interface with the sensor.
To install the library, run the following commands:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gztar -xvzf bcm2835-1.52.tar.gzcd bcm2835-1.52./configuremakesudo make checksudo make install
Next, go to the ~/sensor-project/server directory and create a new file called obtain-readings.js ...
Read now
Unlock full access