I am Working on Connectivity between RaspberryPi 3 and DSLR Camera (Canon 1300 D). When I run command for capture image , first time is working and when I run again I am having following issue:
Please give me solution for "How to communicate Raspberry Pi 3 with DSLR using NodeJs ?"
Code Example:
app.post('/onDemand', function(req, res) {
GPhoto.list(function (list) {
console.log('List:', list);
if (list.length === 0) return;
var camera = list[0];
camera.takePicture({download: true,keep: true}, function (er, data) {
fs.writeFileSync(__dirname + '/input/picture1.jpg', data);
var filePath = "./input/picture1.jpg";
var params = {
Bucket: 'marzs',
Body : fs.createReadStream(filePath),
Key : "marzs/"+Date.now()+"_"+path.basename(filePath)
};
s3.putObject(params, function (err, data) {
if (err) {
console.log('ERROR MSG: ', err);
res.status(500).send(err);
} else {
console.log('Successfully uploaded data');
res.status(200).send({ imageURL: data.Location });
}
res.status(200).send({ imageURL: data.Location });
});
});
});
});
Thanks in Advance.
Yogesh Waghmare
We need to install libusb on server and run following command.
gphoto2 --get-config=capturetarget
gphoto2 --set-config=capturetarget=1
gphoto2 --set-config shutterspeed=bulb
gphoto2 --wait-event=2s --set-config eosremoterelease=Immediate --wait-event=5s --set-config eosremoterelease=Off --wait-event-and-download=5s
After that we need to exit process with "process.exit();" after completion of process. and run via forever command
now code running properly.
Thanks & Regards, Yogesh Waghmare