Commit 6d49b195ff855b70f7edd0acb2e97b8757fe16de

kuva tasatunnein, nimeaminen huomioitu
demot/demo3/tunnin_kuva.py
(21 / 0)
  
1import time
2import picamera
3from datetime import datetime, timedelta
4
5def wait():
6 # tasatunnin viiveen laskenta
7 next_hour = (datetime.now() + timedelta(hours=1)).replace(
8 minute=0, second=0, microsecond=0)
9 delay = (next_hour - datetime.now()).seconds
10 time.sleep(delay)
11
12with picamera.PiCamera() as camera:
13 camera.vflip = True
14 camera.start_preview()
15 wait()
16 for filename in camera.capture_continuous('kuva_{timestamp:%Y-%m-%d-%H-%M}.jpg'):
17 print('Taltioitu %s' % filename)
18 wait()
19
20camera.close()
21sys.exit(1)