-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera Module Tutorial #83
Merged
+142
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
layout: default | ||
--- | ||
|
||
{% capture include_install %} | ||
{% include_relative camera.md %} | ||
{% endcapture %} | ||
{{ include_install | markdownify }} | ||
|
||
{% include_relative _module_footer.html %} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{::options parse_block_html="true" /} | ||
|
||
<div class="row"> | ||
<div class="large-12 columns"> | ||
|
||
## <img class="constrain-sm" src="https://s3.amazonaws.com/technicalmachine-assets/technical-io/modules/usb.png"> Camera | ||
|
||
[<i class="fa fa-github"> View source on Github</i>](https://github.com/tessel/tessel-av) | ||
|
||
### Step 1 | ||
|
||
Make a directory inside your "tessel-code" folder called "camera", change directory into that folder, and initialize a tessel project: | ||
|
||
`mkdir camera; cd camera; t2 init` | ||
|
||
### Step 2 | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="large-6 columns"> | ||
|
||
Plug Tessel into your computer via USB, then plug the camera module into either of Tessel's USB ports. You will also need a [UVC compatible USB camera](https://tessel.io/modules#tessel-av). | ||
|
||
</div> | ||
<div class="large-6 columns"> | ||
|
||
![](http://i.imgur.com/uifn1p7.jpg) | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="large-12 columns"> | ||
|
||
### Step 3 | ||
|
||
Install by typing `npm install tessel-av` into the command line. | ||
|
||
### Step 4 | ||
|
||
Rename "index.js" to "camera.js" and replace the file's contents with the following: | ||
|
||
{% highlight js %} | ||
// Any copyright is dedicated to the Public Domain. | ||
// http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
/********************************************* | ||
Create a server that responds to every request by taking a picture and piping it directly to the browser. | ||
*********************************************/ | ||
|
||
var av = require('tessel-av'); | ||
var os = require('os'); | ||
var http = require('http'); | ||
var port = 8080; | ||
var camera = new av.Camera(); | ||
|
||
http.createServer((request, response) => { | ||
response.writeHead(200, { 'Content-Type': 'image/jpg' }); | ||
|
||
camera.capture().pipe(response); | ||
|
||
}).listen(port, () => console.log(`http://${os.hostname()}.local:${port}`)); | ||
|
||
{% endhighlight %} | ||
|
||
Save the file. | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="large-12 columns"> | ||
|
||
### Step 5 | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="large-6 columns"> | ||
|
||
In your command line, `t2 run camera.js` | ||
|
||
Hooray! You should see the following in your terminal: | ||
|
||
![](http://i.imgur.com/8JdxCON.gif) | ||
|
||
|
||
> Note: `bishop` is just the name of my Tessel 2 board, yours will display whatever you've named your board! | ||
|
||
**Bonus:** EXTRA CHALLENGE FOR VIDEO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a plan for this? |
||
|
||
To see what else you can do with the USB camera module, read the [tessel-av](https://github.com/tessel-av) documentation. | ||
|
||
- Try connecting a button to your Tessel 2 and use it as a shutter. | ||
- Use an USB storage drive to store many photos. | ||
|
||
|
||
|
||
</div> | ||
<div class="large-6 columns"> | ||
|
||
![](http://i.imgur.com/Yjvr1Uc.png) | ||
|
||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="large-12 columns"> | ||
|
||
### Step 6 | ||
|
||
What else can you do with a camera module? Get inspired by a [community-created project.](http://tessel.io/projects) | ||
|
||
|
||
What are you making? [Share your invention!](//tessel.io/projects) | ||
|
||
If you run into any issues you can check out the [module forums](http://forums.tessel.io/c/modules). | ||
|
||
</div> | ||
</div> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the wrong quote types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a template string.