April 2018
Intermediate to advanced
248 pages
5h 31m
English
To use the camera, we need to include a library from npm. We use the pi-camera library, and to install it, run the command in the terminal, as shown in Figure 6.23. Check out the official link for the pi-camera npm module at https://www.npmjs.com/package/pi-camera:

Now, create a file with the name CameraModule.js and include the pi-camera module in it:
const PiCamera = require('pi-camera');
As per the documentation of the pi-camera module, we need to set the configuration of the camera. We define both configurations, one for taking still pictures and the other for taking videos:
const myCameraPhoto = new PiCamera({ ...Read now
Unlock full access