Hardware Reference
In-Depth Information
# Delete the oldest snapshot
shutil.rmtree("../data/snapshot_09", True)
# Rollover snapshots 01..08 into 02..09
for version in range(8,0,-1):
os.rename("snapshot_0" + str(version), "snapshot_0" + str(version+1))
# Make a new snapshot_01 directory
os.mkdir("snapshot_01")
# Move the existing data into the new snapshot_01
os.system("mv *.JPG *.db *.log snapshot_01 > /dev/null 2>&1")
# Now create the latest.jpg link in the current data set
sh.ln("-sf", "initial.jpg", "latest.jpg")
# --------------------------------------------------------------
# Main body of the program
# --------------------------------------------------------------
os.environ['TZ'] = "EST"
# Add this project's bin path so we can pick up gphoto2 and then
# change the current directory to the data directory so we
# can deposit all the photos/data there
os.environ['PATH'] = os.environ['PATH'] + ":../bin"
os.chdir("/home/pi/balloon/data")
# Initialize the GPIO LEDs/switch
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(SW_enable, GPIO.IN)
GPIO.setup(LED_status, GPIO.OUT)
GPIO.setup(LED_gpsok, GPIO.OUT)
GPIO.setup(LED_camera, GPIO.OUT)
# Make sure the LEDs are off by default (will flash them later)
GPIO.output(LED_status, True)
GPIO.output(LED_gpsok, True)
GPIO.output(LED_camera, True)
# Initialize the sensor libraries
Search WWH ::




Custom Search