Last active
January 24, 2026 16:32
-
-
Save dnnsmnstrr/495ac794e6801162fcab4299d6e7d490 to your computer and use it in GitHub Desktop.
Pi Cam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| LED=27 | |
| DIR="$HOME/Pictures" | |
| mkdir -p "$DIR" | |
| raspi-gpio set $LED op | |
| # take picture with timestamp as name | |
| ts=$(date +"%Y-%m-%d_%H-%M-%S") | |
| rpicam-still -o "$DIR/$ts.jpg" | |
| # blink the led | |
| raspi-gpio set $LED dh | |
| sleep 0.2 | |
| raspi-gpio set $LED dl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from gpiozero import Button | |
| from signal import pause | |
| from datetime import datetime | |
| button = Button(17, pull_up=True, bounce_time=0.1) | |
| def pressed(): | |
| print(f'PRESSED {datetime.now().isoformat(timespec="seconds")}', flush=True) | |
| def released(): | |
| print(f'RELEASED {datetime.now().isoformat(timespec="seconds")}', flush=True) | |
| button.when_pressed = pressed | |
| button.when_released = released | |
| print('Waiting for button on GPIO17…') | |
| pause() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| from gpiozero import Button | |
| from signal import pause | |
| import subprocess | |
| from pathlib import Path | |
| script = Path(__file__).parent / 'camera.sh' | |
| button = Button(17, pull_up=True, bounce_time=0.1) | |
| button.when_pressed = lambda: subprocess.Popen([str(script)]) | |
| pause() |
Author
Author
Samba share
sudo nano /etc/samba/smb.conf
Append
[Pictures]
path = /home/pi/Pictures
browseable = yes
read only = no
guest ok = yes
force user = pi
Then sudo systemctl restart smbd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
systemd service
sudo nano /etc/systemd/system/camera.service