mirror of
https://gitlab.com/imvec/picapikap.git
synced 2026-06-16 12:30:20 +02:00
Update PicaPiKAP.py
This commit is contained in:
+24
-29
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user