diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rwxr-xr-x | ldr-counter.py | 8 | ||||
| -rw-r--r-- | ldr-counter.service | 5 | ||||
| -rw-r--r-- | x | 0 |
4 files changed, 9 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aad3d38 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +ldr-readings.txt diff --git a/ldr-counter.py b/ldr-counter.py index 362ab55..a399457 100755 --- a/ldr-counter.py +++ b/ldr-counter.py @@ -61,7 +61,7 @@ def appendReading (ldrCount): timestamp = datetime.now(timezone.utc).astimezone().isoformat() # write the data - f = open("ldr-readings.txt", "a") + f = open("/home/st33v/sense/light/ldr-readings.txt", "a") f.write(timestamp + ' ' + " ".join(map(str, ldrCount)) + '\n') f.close() @@ -70,10 +70,10 @@ def appendReading (ldrCount): obs=list() # an empty list for num in range(0, obsCount): obs.append(RCtime()) - print(obs) +# print(obs) -print("sum=", sum(obs)) -print("Ave time: ", sum(obs)/obsCount) # Measure timing using GPIO4 +#print("sum =", sum(obs)) +#print("Ave time: ", sum(obs)/obsCount) # Measure timing using GPIO4 appendReading(obs) diff --git a/ldr-counter.service b/ldr-counter.service index 64c113c..495835d 100644 --- a/ldr-counter.service +++ b/ldr-counter.service @@ -3,6 +3,9 @@ Description=Read light level from LDR and store result in file [Service] Type=oneshot -User=st33v +User=root # WorkingDirectory=/home/st33v/light/ ExecStart=/usr/local/bin/ldr-counter.py + +[Install] +WantedBy=ldr-counter.timer |
