Last active
August 11, 2019 02:09
-
-
Save charlsagente/b4191581c33fb69ee6a9d8361c4409a2 to your computer and use it in GitHub Desktop.
Raspberry Pi Camera
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
# 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/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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment