Sensor module code

Now, we write the code for sensor modules, which will govern the functioning of all the sensors and LED. To accomplish our task, we need an npm module called pigpio, which gives us access to the GPIO of Raspberry Pi. To install the pigpio module, run the sudo npm install pigpio command in the terminal as shown in Figure 6.25:

Figure 6.25

Check out the official npm link at https://www.npmjs.com/package/pigpio for more details about the pigpio module.

Create a file with the name Survillance.js and include the pigpio module. We also include CameraModule.js and EmailModule.js, which we developed in the previous section. This ...

Get Internet of Things with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.