Skip to content

Instantly share code, notes, and snippets.

@Teemu
Created March 14, 2016 11:04
Show Gist options
  • Save Teemu/d8d776ceeec0c59500a1 to your computer and use it in GitHub Desktop.
Save Teemu/d8d776ceeec0c59500a1 to your computer and use it in GitHub Desktop.
Take timelapse with Raspberry Pi and unstable webcam
#!/bin/sh
# https://gist.github.com/x2q/5124616#file-usbreset-c-L41
/usr/bin/usbreset /dev/bus/usb/001/002
pi ALL = (ALL) ALL
pi ALL = (root) NOPASSWD: /usr/bin/reset_webcam
#!/bin/sh
while true; do
echo "Taking screenshot..."
prefix=`date +"img-%Y-%m-%d_%H-%M-%S.jpg"`
fswebcam -r 1280x720 --no-banner $prefix
sudo /usr/bin/reset_webcam
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment