From 92a9146836d751c73753fd6dc199b9a0073bc2ac Mon Sep 17 00:00:00 2001 From: imvec Date: Fri, 2 Sep 2022 12:24:44 +0000 Subject: [PATCH] Update PicaPiKAP.py --- PicaPiKAP.py | 53 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/PicaPiKAP.py b/PicaPiKAP.py index 638c212..1c4fdd6 100644 --- a/PicaPiKAP.py +++ b/PicaPiKAP.py @@ -1,4 +1,3 @@ -import csv import time import gpsd import board @@ -18,32 +17,28 @@ gpsd.connect() camera = PiCamera() camera.resolution = (3280, 2464) -#camera.led = False -with open("/home/pi/PicaPiKAP/datalog.csv", "a") as log: - - while True: - tiempo = (time.strftime("%y%b%d_%H:%M:%S_")) - packet = gpsd.get_current() - tiempogps = str(packet.time) - longitud = str("%0.5f_" % packet.lon) - latitud = str("%0.5f_" % packet.lat) - altitudgps = str("%0.1fm_" % packet.alt) - temperatura = str("%0.1fC_" % bme280.temperature) - humedad = str("%0.1f%%_" % bme280.relative_humidity) - presion = str("%0.1fhPa" % bme280.pressure) - altitud = str("%0.1fm_" % bme280.altitude) - log.write("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}\n".format(time.strftime("%y%b%d_%H:%M:%S"),str(packet.time),str(packet.sats),str("%0.5f" % packet.lon),str("%0.5f" % packet.lat),str("%0.1f_" % packet.alt),str("%0.1f" % bme280.altitude),str("%0.1f" % packet.climb),str("%0.1f" % bme280.temperature),str("%0.1f" % bme280.relative_humidity),str("%0.1f" % bme280.pressure))) - camera.capture("/home/pi/PicaPiKAP/media/" + tiempogps + latitud + longitud + altitudgps + temperatura + humedad + presion + ".jpg") - print("Datos del GPS") - print("Satelites: " + str(packet.sats)) - print("Latitud:" + str("%0.5f" % packet.lat)) - print("Longitud:" + str("%0.5f" % packet.lon)) - print("Altitud GPS:" + str("%0.1f" % packet.alt)) - print("\nDatos del BME280") - print("Temperatura: %0.1f C" % bme280.temperature) - print("Humedad relativa: %0.1f %%" % bme280.relative_humidity) - print("Presion: %0.1f hPa" % bme280.pressure) - print("Altitud = %0.1f metros" % bme280.altitude) - print("-----") - time.sleep(5) +while True: + tiempo = (time.strftime("%y%b%d_%H:%M:%S_")) + packet = gpsd.get_current() + tiempogps = str(packet.time) + longitud = str("%0.5f_" % packet.lon) + latitud = str("%0.5f_" % packet.lat) + altitudgps = str("%0.1fm_" % packet.alt) + temperatura = str("%0.1fC_" % bme280.temperature) + humedad = str("%0.1f%%_" % bme280.relative_humidity) + presion = str("%0.1fhPa" % bme280.pressure) + altitud = str("%0.1fm_" % bme280.altitude) + camera.capture("/home/pi/PicaPiKAP/media/" + tiempogps + latitud + longitud + altitudgps + temperatura + humedad + presion + ".jpg") + print("Datos del GPS") + print("Satelites: " + str(packet.sats)) + print("Latitud:" + str("%0.5f" % packet.lat)) + print("Longitud:" + str("%0.5f" % packet.lon)) + print("Altitud GPS:" + str("%0.1f" % packet.alt)) + print("\nDatos del BME280") + print("Temperatura: %0.1f C" % bme280.temperature) + print("Humedad relativa: %0.1f %%" % bme280.relative_humidity) + print("Presion: %0.1f hPa" % bme280.pressure) + print("Altitud = %0.1f metros" % bme280.altitude) + print("-----") + time.sleep(5)