How do you mix raspberry pi python code of two csv recordsdata?

we're sending a climate ballon to house with a raspberry pi sense hat and rasp pi digital camera V2 we now have the code written to save lots of to file

That is the code to take photos

from picamera import PiCamera
from time import sleep

digital camera = PiCamera()

digital camera.start_preview()

digital camera.start_preview(alpha=200)
digital camera.rotation = 180

for i in vary(3):

    sleep(5)
    
    digital camera.seize('/residence/pi/Desktop/imagepercents.jpg' % i)

digital camera.stop_preview()

and that is the code to sense the enviroment

from sense_hat import SenseHat
import time
sense=SenseHat()

file = open("Datafile.csv","a")

file.write("Time, Humidity, Temperature, Stress")

print ("Time, Humidity, Temperature, Stress")

for n in vary(60 ):
    humidity = sense.get_humidity()
    humidity = spherical(humidity, 2)
    
    file.write(time.strftime('%X'))
    file.write(",") 
    file.write(str(humidity))
    file.write("/n")

    temperature = sense.get_temperature()
    temperature = spherical(temperature, 2)
    
    print (time.strftime('%X'),humidity)
    
    file.write(time.strftime('%X'))
    file.write(",") 
    file.write(str(temperature))
    file.write("/n")
    
    temperature = sense.get_temperature()
    temperature = spherical(temperature, 2)
    
    print (time.strftime('%X'),temperature)
    
    stress = sense.get_pressure()
    stress = spherical(stress, 2)
    
    file.write(time.strftime('%X'))
    file.write(",") 
    file.write(str(stress))
    file.write("n")
    
    print (time.strftime('%X'),stress)
    time.sleep(1)

file.shut()

Each work we're simply now attempting to mix them. Please assist!!



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *