-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (26 loc) · 975 Bytes
/
index.js
File metadata and controls
36 lines (26 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var RaspiCam = require("raspicam");
var mkdirp = require('mkdirp');
var imagesDirectory = '/var/rhiot/camera/queue'
mkdirp(imagesDirectory, function (err) {
if (err) console.error(err);
var camera = new RaspiCam({
mode: "timelapse",
output: imagesDirectory + "/image_%06d.jpg",
encoding: "jpg",
timelapse: 1000,
timeout: 120000 // take a total of 4 pictures over 12 seconds
});
camera.on("start", function( err, timestamp ){
console.log("timelapse started at " + timestamp);
});
camera.on("read", function( err, timestamp, filename ){
console.log("timelapse image captured with filename: " + filename);
});
camera.on("exit", function( timestamp ){
console.log("timelapse child process has exited");
});
camera.on("stop", function( err, timestamp ){
console.log("timelapse child process has been stopped at " + timestamp);
});
camera.start();
});