node-raspicam icon indicating copy to clipboard operation
node-raspicam copied to clipboard

Could not make it work so far

Open zettam opened this issue 9 years ago • 2 comments

Some hand would be pretty. Here is my test code based on the documentation:

var RaspiCam = require("raspicam");

var camera = new RaspiCam({ mode:"photo", output:"testfile" });

//to take a snapshot, start a timelapse or video recording
camera.start( );
console.log("start")

//to stop a timelapse or video recording
camera.stop( );

//listen for the "started" event triggered when the start method has been successfully initiated
camera.on("started", function(){ 
    console.log("started")
});

//listen for the "read" event triggered when each new photo/video is saved
camera.on("read", function(err, filename){ 
    console.log("saved")
});

//listen for the process to exit when the timeout has been reached
camera.on("exited", function(){
    console.log("timeout")
});

I do not see any files anywhere. "saved" console.log never triggers. I'm on raspberry pi 2 with a noircam module. Camera is enabled and raspicam command normally works (without npm)

zettam avatar Sep 26 '15 08:09 zettam

This line is stopping the camera before it even gets a chance to take the photo camera.stop( );

mikeboehm avatar Apr 24 '16 18:04 mikeboehm

@mikeboehm this is where I think an update to the docs could go a long way. A good example of how to start the camera and take a still would be very helpful. Currently the docs list the start and stop commands right next to each other with no explanation.

I am assuming that to take a still you do something like this:

var camera = new RaspiCam({ mode:"photo", output:"testfile" });

camera.on("read", function(){ 
    camera.stop();
});

camera.start( );

newmanw avatar Oct 03 '17 14:10 newmanw