Hardware Reference
In-Depth Information
global press
global altP
global tempP
# Get the pressure sensor data
press = pressure.readPressure()
altP = pressure.readAltitude()
tempP = pressure.readTemperature()
#
# Take a photo (and flash the photo status LED)
#
def takePhoto():
GPIO.output(LED_camera, False)
filename = time.strftime("%Y%m%d_%H%M%S.JPG")
sh.gphoto2("--capture-image-and-download", "--keep", "--force-overwrite",
"--filename", filename)
if (os.path.isfile(filename)):
sh.ln("-sf", filename, "latest.jpg")
else:
print "missing file:", filename
GPIO.output(LED_camera, True)
#
# Create a brand new sqllite dbase and populate it with a dummy record
#
def createDB():
global con
DB_FILENAME = "../data/10DOF_data.db"
con = db.connect(DB_FILENAME)
with con:
cur = con.cursor()
cur.execute("CREATE TABLE Sensors("
"Lat REAL, Long REAL, AltG REAL, TimeG TEXT, "
"XA REAL, YA REAL, ZA REAL, ROLL REAL, PITCH REAL, "
"XM REAL, YM REAL, ZM REAL, XMH REAL, YMH REAL, ZMH
REAL, "
"XR REAL, YR REAL, ZR REAL, TempG REAL, "
"Pressure REAL, AltP REAL, TempP REAL)")
Search WWH ::




Custom Search