Skip to content

Instantly share code, notes, and snippets.

@jerram
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerram/733c06e8927bf23f75e3 to your computer and use it in GitHub Desktop.
Save jerram/733c06e8927bf23f75e3 to your computer and use it in GitHub Desktop.
Tessel Camera Module doesnt run takePicture()
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
/*********************************************
This camera example takes a picture. If a
directory is specified with the --upload-dir
flag, the picture is saved to that directory.
*********************************************/
var tessel = require('tessel');
var camera = require('camera-vc0706').use(tessel.port['A']);
var notificationLED = tessel.led[3]; // Set up an LED to notify when we're taking a picture
// Wait for the camera module to say it's ready
console.log('starting');
camera.on('ready', function() {
notificationLED.high();
// Take the picture
camera.takePicture(function(err, image) {
console.log('taking picture');
if (err) {
console.log('error taking image', err);
} else {
notificationLED.low();
// Name the image
var name = 'picture-' + Math.floor(Date.now()*1000) + '.jpg';
// Save the image
console.log('Picture saving as', name, '...');
process.sendfile(name, image);
console.log('done.');
// Turn the camera off to end the script
camera.disable();
}
});
console.log('finish');
});
camera.on('error', function(err) {
console.error(err);
});
/**
cd ~/dev/
npm install -g tessel
tessel
tessel version
>> INFO v0.3.23
which tessel
>> /usr/local/bin/tessel
tesel update
tessel show
tessel list
tessel blink
>> <blinks>
mkdir camera
cd camera
npm install camera-vc0706
s camera.js # open with sublime
tessel push camera.js --upload-dir ./ -l
>>
TESSEL! Connected to TM-00-04-f000da30-00644745-48382586.
INFO Bundling directory /Users/jerramw/dev/camera
INFO Deploying bundle (104.00 KB)...
INFO Finished deployment
starting
finish
tessel run camera.js --upload-dir ./
>> same
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment