Skip to content

Instantly share code, notes, and snippets.

@lee2sman
Last active April 16, 2024 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lee2sman/9e000400843e49cd533c5e72627aac38 to your computer and use it in GitHub Desktop.
Save lee2sman/9e000400843e49cd533c5e72627aac38 to your computer and use it in GitHub Desktop.

Let's update the software on our Pi.

sudo apt update
sudo apt upgrade
  1. Test python.
python --version

Make sure you are running version 3. If not successful, you will need to run python3.

Check to see if you have PiCamera2 installed.

python -c "import Picamera2"

If not, install:

sudo apt install python3-picamera2
  1. Connect camera

Turn Pi off. Plug in cable in right orientation.

  1. TEST it works.

Try running the still photo program from picamera2.

libcamera-still -o test.jpg
  1. Basic script using Picamera2
from picamera2 import Picamera2

picam2 = Picamera2()

picam2.start_and_capture_file("test.jpg")

This should take a photo and save to your current directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment