Ik ben bezig met een timelaps 'systeem' met een rp3 en pi-camera, mooie tutorial gevonden
hier
In de comments staat hoe je het kan aanpassen om hem bv 2 weken elke van 6.00 tot 20.00 uur foto's te laten nemen.
Echter, bij mij stop hij netjes om 20.00 uur maar hij begint niet om 6.00.
kan iemand in het script vinden waar het misgaat, ik heb er (helaas) te weinig verstand van.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
| #!/usr/bin/env python
#
# raspiLapseCam.py
#
# Created by James Moore on 28/07/2013.
# Modified by James Moore on 13/11/2013.
# Copyright (c) 2013 Fotosyn. All rights reserved.
#
# Raspberry Pi is a trademark of the Raspberry Pi Foundation.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.>
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.
# This script sets up and runs a Python Script which, at intervals invokes a capture
# command to the Raspberry Pi camera, and stores those files locally in a dynamically
# named folder.
# To invoke, copy this script to an easy to find file location on your Raspberry Pi
# (eg. /home/pi/), log into your Raspberry Pi via terminal and type:
#
# sudo python /your/file/location/raspiLapseCam.py (add &) if you wish to run as a
# background task. A process ID will be shown which can be ended with
# sudo kill XXXX (XXXX = process number)
# Based on your settings the application will now begin capturing images
# saving them to your chosen file location (same as current location of this file as default.
# Import some frameworks
import os
import time
import RPi.GPIO as GPIO
import logging
from datetime import datetime
# Grab the current datetime which will be used to generate dynamic folder names
d = datetime.now()
initYear = "%04d" % (d.year)
initMonth = "%02d" % (d.month)
initDate = "%02d" % (d.day)
initHour = "%02d" % (d.hour)
initMins = "%02d" % (d.minute)
# Define the location where you wish to save files. Set to HOME as default.
# If you run a local web server on Apache you could set this to /var/www/ to make them
# accessible via web browser.
folderToSave = "/home/timelapse/timelapse_" + str(initYear) + str(initMonth) + str(initDate) + str(initHour) + str(initMins)
os.mkdir(folderToSave)
# Set up a log file to store activities for any checks.
logging.basicConfig(filename=str(folderToSave) + ".log",level=logging.DEBUG)
logging.debug(" R A S P I L A P S E C A M -- Started Log for " + str(folderToSave))
logging.debug(" Support at http://fotosyn.com/timelapse/")
# Set the initial serial for saved images to 1
fileSerial = 1
# Run a WHILE Loop of infinitely
while True:
d = datetime.now()
if d.hour > 6 and d.hour < 20:
# Set FileSerialNumber to 000X using four digits
fileSerialNumber = "%04d" % (fileSerial)
# Capture the CURRENT time (not start time as set above) to insert into each capture image filename
hour = "%02d" % (d.hour)
mins = "%02d" % (d.minute)
# Define the size of the image you wish to capture.
imgWidth = 800 # Max = 2592
imgHeight = 600 # Max = 1944
print " ====================================== Saving file at " + hour + ":" + mins
# Capture the image using raspistill. Set to capture with added sharpening, auto white balance and average metering mode
# Change these settings where you see fit and to suit the conditions you are using the camera in
os.system("raspistill -w " + str(imgWidth) + " -h " + str(imgHeight) + " -o " + str(folderToSave) + "/" + str(fileSerialNumber) + "_" + str(hour) + str(mins) + ".jpg -sh 40 -awb auto -mm average -v")
# Write out to log file
logging.debug(' Image saved: ' + str(folderToSave) + "/" + str(fileSerialNumber) + "_" + str(hour) + str(mins) + ".jpg")
# Increment the fileSerial
fileSerial += 1
# Wait 60 seconds (1 minute) before next capture
time.sleep(60)
else:
# Just trapping out the WHILE Statement
print " ====================================== Doing nothing at this time" |
Edit, het is geen zins de code hier te dumpen met de boodschap, los het eens op voor me. Code tags zocht ik naar maar kon ze niet vinden, nu wel.
het gaat over dit stukje, zover was ik al
code:
1
2
| d = datetime.now()
if d.hour > 6 and d.hour < 20: |
normaal staat daar
if d.hour < 99:
dat werkt wel, dat gaat hij gewoon door.
Ik ga er vanuit dat d.hour terug naar 0 gaat na middernacht, maar wellicht is dat niet zo. Ik heb hier al dagen over gegoogled en allerlei dingetjes geprobeerd maar ik loop toch steeds vast op dit stukje.
[
Voor 4% gewijzigd door
Klein_Kipje op 29-03-2017 10:52
]