Changes

Jump to navigation Jump to search
Line 483: Line 483:  
* two way communication
 
* two way communication
 
* encryption
 
* encryption
 +
 +
== Capturing with the camera ==
 +
[[File:Captureta camera.jpg]]
 +
 +
Load the following code into the Python block
 +
 +
def myblock(lc, x):
 +
    import gst, time
 +
 +
# grab a frame from camera to file
 +
    pipeline = gst.parse_launch('v4l2src ! ffmpegcolorspace ! jpegenc ! filesink location=/tmp/turtlepic.jpg')
 +
    pipeline.set_state(gst.STATE_PLAYING)
 +
 +
# pause for a second to allow the camera frame to be grabbed
 +
    time.sleep(1)
 +
 +
# stop the camera frame grabbing
 +
    pipeline.set_state(gst.STATE_NULL)
 +
 +
 +
This saves a photo to /tmp/turtlepic.jpg
 +
 +
 +
Here is the Turtle Art program, the show media tile displays /tmp/turtlepic.jpg
 +
 +
There are two ways to make the show media tile point to the file system and not the Journal
 +
 +
1 hand edit the code in the *.ta file with write
 +
2 Run Turtle Art under Gnome which has a file choser rather than an object choser, the settings in the block are retained if the saved project is later run under Sugar
    
==Links==
 
==Links==
2,486

edits

Navigation menu