from astro_pi import AstroPi
import time
import sys
ap = AstroPi()

f = open("data_file.txt", "w")

for i in range (0,10):
	localtime = time.asctime(time.localtime(time.time()))
	print localtime
	ap.show_message("Temp: ")
	temp = str(round(ap.get_temperature(),1))
	ap.show_message(temp)
	
	ap.show_message("Pres: ")
	pressure  = str(round(ap.get_pressure(),1))
	ap.show_message(pressure)

	ap.show_message("Hum: ")
	humidity = str(round(ap.get_humidity(),1))
	ap.show_message(humidity)
	ap.clear()
	f.write (localtime + "|")
	f.write (temp + "|")
	f.write (pressure + "|")
	f.write (humidity + "n")
	time.sleep(30)

f.close()

Without giving too much away at this stage our entry for the Astro-Pi competition is progressing well. We have an idea, an experiment we can do in space. We just need some code.

Today we tried recording data from the sensors and putting them into a file.

For the last lesson of the day we recorded the temperature, humidity and pressure

We should have another update coming soon …. 

Leave a Reply

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