Created
February 21, 2015 07:09
-
-
Save isma44/9c1d19e646afb68d9f0e to your computer and use it in GitHub Desktop.
Ricoh Theta Test by Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for Mac | |
// module.paths.push('/usr/local/lib/node_modules'); | |
var Theta = require('ricoh-theta'); | |
var theta = new Theta(); | |
theta.connect('192.168.1.5'); | |
// capture | |
theta.on('connect', function(){ | |
theta.capture(function(err){ | |
if(err) return console.error(err); | |
console.log('capture success'); | |
}); | |
}); | |
// get picture | |
theta.on('objectAdded', function(object_id){ | |
theta.getPicture(object_id, function(err, picture){ | |
fs.writeFile('tmp.jpg', picture, function(err){ | |
console.log('picture saved => tmp.jpg'); | |
theta.disconnect(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment