Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Internet of Things with Raspberry Pi 3

You're reading from   Internet of Things with Raspberry Pi 3 Leverage the power of Raspberry Pi 3 and JavaScript to build exciting IoT projects

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher Packt
ISBN-13 9781788627405
Length 248 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Maneesh Rao Maneesh Rao
Author Profile Icon Maneesh Rao
Maneesh Rao
Arrow right icon
View More author details
Toc

The code

Let's write the code to bring our surveillance system to life.

The setup requires Node.js to be installed on Raspberry Pi which we have already done quite a few times through out this book so we will not repeat that and straightaway start writing the code.

Camera module code

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:

Figure 6.23

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image