PiCam: Difference between revisions

From XPUB & Lens-Based wiki
Line 29: Line 29:
See [https://www.raspberrypi.org/learning/getting-started-with-picamera/ this tutorial on raspberrypi.com]
See [https://www.raspberrypi.org/learning/getting-started-with-picamera/ this tutorial on raspberrypi.com]


<pre lang="python">
<source lang="python">
from picamera import PiCamera
from picamera import PiCamera
from time import sleep
from time import sleep
Line 38: Line 38:
sleep(10)
sleep(10)
camera.stop_preview()
camera.stop_preview()
</pre>
</source>

Revision as of 12:33, 15 March 2017

connecting the camera

gently lift the black clip by pushing upward. insert the ribbon cable of the camera firmly down. the blue side goes towards the headphone jack! push the clip down again.

See: connect-camera.jpg

setup

warning: this info is in progress -- may not (yet) represent a useful thing

  • ok this link in the end was totally misleading -- in fact you (maybe?) just need to add some stuff to /boot/config.txt

(the audio thing is unrelated to the camera, but may be useful -- I think it forces audio to the mini jack?! ie not to HDMI)

/boot/config.txt

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
start_x=1
gpu_mem=128


test the camera

 raspistill -o test.jpg

connecting via python

See this tutorial on raspberrypi.com

from picamera import PiCamera
from time import sleep

camera = PiCamera()
camera.rotation=270
camera.start_preview()
sleep(10)
camera.stop_preview()