Skip to content

Instantly share code, notes, and snippets.

@charlsagente
Last active August 11, 2019 02:09
Show Gist options
  • Select an option

  • Save charlsagente/b4191581c33fb69ee6a9d8361c4409a2 to your computer and use it in GitHub Desktop.

Select an option

Save charlsagente/b4191581c33fb69ee6a9d8361c4409a2 to your computer and use it in GitHub Desktop.

Revisions

  1. charlsagente revised this gist Aug 11, 2019. 1 changed file with 14 additions and 2 deletions.
    16 changes: 14 additions & 2 deletions camera.py
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,22 @@
    # Take still pictures with Python

    from picamera import PiCamera
    from time import sleep

    camera = PiCamera()
    camera.rotation = 180 # You can rotate the image by 90, 180 or 270 degrees
    camera.start_preview() # Make the camera preview

    for i in range(5):
    sleep(5) # The camera should take one picture every five seconds.
    camera.capture('/home/pi/image%s.jpg' % i)
    camera.stop_preview()
    camera.capture('/home/pi/Desktop/image%s.jpg' % i)
    camera.stop_preview()


    # Recording video with Python

    camera.start_preview()
    camera.start_recording('/home/pi/Desktop/video.h264')
    sleep(5)
    camera.stop_recording()
    camera.stop_preview()
  2. charlsagente created this gist Aug 11, 2019.
    10 changes: 10 additions & 0 deletions camera.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    from picamera import PiCamera
    from time import sleep

    camera = PiCamera()
    camera.rotation = 180 # You can rotate the image by 90, 180 or 270 degrees
    camera.start_preview() # Make the camera preview
    for i in range(5):
    sleep(5) # The camera should take one picture every five seconds.
    camera.capture('/home/pi/image%s.jpg' % i)
    camera.stop_preview()