Let's update the software on our Pi.
sudo apt update
sudo apt upgrade
- 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
- Connect camera
Turn Pi off. Plug in cable in right orientation.
- TEST it works.
Try running the still photo program from picamera2.
libcamera-still -o test.jpg
- 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.