Activities/Turtle Art/Using Turtle Art Sensors: Difference between revisions

Tonyforster (talk | contribs)
Tonyforster (talk | contribs)
Line 491: Line 491:
  def myblock(lc, x):
  def myblock(lc, x):
     import gst, time
     import gst, time
  # grab a frame from camera to file
  # grab a frame from camera to file
     pipeline = gst.parse_launch('v4l2src ! ffmpegcolorspace ! jpegenc ! filesink location=/tmp/turtlepic.jpg')
     pipeline = gst.parse_launch('v4l2src ! ffmpegcolorspace ! jpegenc ! filesink location=/tmp/turtlepic.jpg')
     pipeline.set_state(gst.STATE_PLAYING)
     pipeline.set_state(gst.STATE_PLAYING)
  # pause for a second to allow the camera frame to be grabbed
  # pause for a second to allow the camera frame to be grabbed
     time.sleep(1)
     time.sleep(1)
  # stop the camera frame grabbing
  # stop the camera frame grabbing
     pipeline.set_state(gst.STATE_NULL)
     pipeline.set_state(gst.STATE_NULL)