I'm sending up a weather balloon controlled by a Raspberry Pi and BMP085 Sensor, and I'm using some Python Code via I2C to run it. I want to modify the Adafruit BMP085 Example Code that is runs it every half an hour:
#!/usr/bin/python
from Adafruit_BMP085 import BMP085
# ===========================================================================
# Example Code
# ===========================================================================
# Initialise the BMP085 and use STANDARD mode (default value)
# bmp = BMP085(0x77, debug=True)
bmp = BMP085(0x77)
# To specify a different operating mode, uncomment one of the following:
# bmp = BMP085(0x77, 0) # ULTRALOWPOWER Mode
# bmp = BMP085(0x77, 1) # STANDARD Mode
# bmp = BMP085(0x77, 2) # HIRES Mode
# bmp = BMP085(0x77, 3) # ULTRAHIRES Mode
temp = bmp.readTemperature()
pressure = bmp.readPressure()
altitude = bmp.readAltitude()
print "Temperature: %.2f C" % temp
print "Pressure: %.2f hPa" % (pressure / 100.0)
print "Altitude: %.2f" % altitude
I was planning to run it using a shell script, but it feels too much power on shell,
#!/bin/bash
while true; do
/gryphon7i/alt/altitude_ai >> measurements.log
sleep 1800
done
What can I do to modify the code to record it every half and hour? Should I just stick the shell script? Thank you for any help in advance.