#---------------------------------------------------------------------- # SABVABAA Hovercraft Seismic Profiling Gun Control Program # # University of Bergen, Norway # Dept. of Earth Science # # Rev Date By Description # --------------------------------------------------------------------- # 0.1 June 8 2008 OM Test version #---------------------------------------------------------------------- import time import serial import winsound VERSION = "Ver. 0.1 Date: 9 June 2008" COM_PORT = 0 # '0' = COM1 -> On the rear of the DELL Latitude D630 #------------------------------------------------------------ # Subroutine: Fire GUNCO #------------------------------------------------------------ def FireAirGun(): for k in range(1): winsound.Beep(800, 50) winsound.Beep(1000, 30) print "Fire!", time.strftime("%a, %d %b %Y %H:%M:%S", time.gmtime()) ser.setDTR(level=1) time.sleep(0.01) ser.setDTR(level=0) #------------------------------------------------------------ # M A I N P R O G R A M #------------------------------------------------------------ print ''' ============================================================== SABVABAA Hovercraft Seismic Profiling Gun Control Program Terminate program by CTRL-C (may wait a bit) ''' print "Version ...........:", VERSION print "Serial port used ..: COM", int(COM_PORT + 1) print ''' University of Bergen, Norway Dept. of Earth Science ============================================================== ''' #--- Open COM port for GUN control #--- DTR -> GUN1 -> fire from 0 to 1 state #--- RTS -> GUN2 -> ---"--- ser = serial.Serial(0) # "0" equals serial port 1 (COM1) ser.setDTR(level=0) ShotInterval = int(raw_input("Shot interval [s]: ")) print "Shot interval = ", ShotInterval, "s" print "Shooting in 5 seconds ..." t = 4 while t > 0: print t t -= 1 time.sleep(1) print FireAirGun() #-------------- Loop eternally. Interrupt by CTRL-C while 1: time.sleep(ShotInterval) FireAirGun() ser.close() exit()