|
Raspberry Pi 3B+Raspberry Pi
|
x 1 | |
|
Button |
x 1 | |
|
Raspberry Pi camera module (CSI interface night vision focal length adjustable) |
x 1 |
Push Button Stop Motion With Raspberry Pi
Before booting your Pi, you’ll need to connect the camera.
We will need to install the camera. To do this, go to the ribbon slot and use two fingers to pull up on both sides of the connector gently.
Now the connector is open. Insert the ribbon cable with the metal leads facing away from the Ethernet port. Make sure it's lined up, then gently press down on the connector. The cable should be locked in place, and we can now move on.
Using your breadboard and jumper leads, connect the Pi to the button as shown in the diagram below: (Image credit: RaspberryPi.org)
You must create a new folder to store your stills. In the terminal window, enter
mkdir animation
For the code, open Thonny python, then, type in the following code:
from picamera import PiCamera
from time import sleep
from gpiozero import Button
button = Button(17)
camera = PiCamera()
camera.start_preview()
frame = 1
while True:
try:
button.wait_for_press()
camera.capture('/home/pi/animation/frame%03d.jpg' % frame)
frame += 1
except KeyboardInterrupt:
camera.stop_preview()
break
from picamera import PiCamera
from time import sleep
from gpiozero import Button
button = Button(17)
camera = PiCamera()
camera.start_preview()
frame = 1
while True:
try:
button.wait_for_press()
camera.capture('/home/pi/animation/frame%03d.jpg' % frame)
frame += 1
except KeyboardInterrupt:
camera.stop_preview()
break
Push Button Stop Motion With Raspberry Pi
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Engineer
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
74 0 0 -
DIY Laser Power Meter with Arduino
86 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
120 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
416 0 1 -
Custom Mechanic Keyboard - STM32
243 0 3