Hardware Reference
In-Depth Information
if (GPIO.input(SW_enable)):
# Update the dbase with the latest sensor readings
updateDB()
# Is it also time for a new photo?
if (time.time() > next_camera_time):
takePhoto()
# Now calculate the time for the next photo
next_camera_time = next_camera_time + CAMERA_PERIOD
# Delay for 0.5 seconds (this controls the activity LED flash rate)
time.sleep(0.5)
This is the script that generates the main station ID web page, stationid.py :
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sqlite3 as db
import sys
import time
import cgitb
cgitb.enable()
import cgi
def openDB():
global con
DB_FILENAME = "../data/10DOF_data.db"
con = db.connect(DB_FILENAME)
try:
openDB()
except db.Error, e:
print "<!DOCTYPE html><head><meta http-equiv='refresh' content='15'></
head>Error %s:</html>" % e.args[0]
sys.exit(1)
try:
cur = con.cursor()
cur.execute('select * from Sensors order by TimeG desc limit 1')
rows = cur.fetchall()
Search WWH ::




Custom Search