I needed camera control with Scratch on the Raspberry Pi for a primary school aerial photography project. I added a new python extension for Simon’s ScratchGPIO that allows either the Raspberry Pi camera or a regular USB webcam to be used with Scratch.
Add your camera – if you’re using the Raspberry Pi camera, follow their instructions here. If it’s a USB camera then just plug it in.
After you’ve started scratch, all you need is to make a broadcast block and set it’s message to ‘photo’. Here’s what we used for the aerial photography project:
This program starts automatically, then in a loop flashes an LED on pin 8 and takes a photo.
Photos are stored in /home/pi/photos, each photo has a number that increases as the photos are taken.
Make sure you delete/backup your photos regularly or you’ll run out of space fairly fast!