#!/usr/bin/python import os import header import time header.init() ## Turn laser Relay off, and set power off (1.8V) os.system('echo "0" |sudo tee /sys/class/gpio/gpio%s/value' %(header.laserPower)) time.sleep(1) os.system('echo "0" |sudo tee /sys/class/gpio/gpio%s/value' %(header.laserRelay))
""" Date Created: 2017.10.10 This script monitors the laser diode current. It can turn the laser off if diode current hits a critical value (TBD mA) This script should be called as a subproccess by the main function so it can run continuously in the background """ import time import SET import PRINT import header header.init() def readCurrent(): ## Read the laser diode current voltage = int(open(header.diodeC).read()) """ TO BE WRITTEN: Convert the ADC value of voltage to actual voltage in mV """ ## To convert from voltage to diode current, the conversion is 10 mV = 1 mA ## Nominal operating current for 405 nm laser is 50 mA (60 mA absolute max) current = voltage / 10
import datetime import re import subprocess ##import runDHM # external .py script that runs DHM import header # declaration file to initialize super global variables ## Message list a = 'DHM_on' # Turn on Laser (prepare for DAQ) b = 'DHM_off' # Turn off laser c = 'DHM_record' # Record holograms ## 'c' should be followed by integer for DAQ time d = 'DHM_status' # Query for DHM status e = 'DHM_newSample' # Turn on pump for new sample f = 'DHM_auto' # Let DHM run its own cycle z = 'SYS_off' # Non-emergency shutdown header.init() # Define global variables from header.py # Status variables laserStat = 'off' pumpStat = 'off' def time_stamp(): ts = time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%H:%M:%S %Y.%m.%d') return (st, ts) def temp_reading(): subprocess.call(["sudo","%s/tempReading.py" % (header.GPIOfolder)]) return (st,ts) = time_stamp()