![]() |
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

Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW
ESP32-S3 4.3inch Capacitive Touch Display Development Board, 800×480, 5-point Touch, 32-bit LX7 Dual-core Processor
BUY NOW
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- 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
-
Commodore 64 1541-II Floppy Disk Drive C64 Power Supply Unit USB-C 5V 12V DIN connector 5.25
126 1 2 -
Easy to print simple stacking organizer with drawers
75 0 0 -
-
-
-
Modifying a Hotplate to a Reflow Solder Station
1116 1 6 -
MPL3115A2 Barometric Pressure, Altitude, and Temperature Sensor
627 0 1 -
-
Nintendo 64DD Replacement Shell
478 0 2 -
V2 Commodore AMIGA USB-C Power Sink Delivery High Efficiency Supply Triple Output 5V ±12V OLED display ATARI compatible shark 100W
1398 4 3