import serial port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=3.0) #serial strings #select audio a = "0ACS\r\n" #select video v = "0VCS\r\n" #select both av = "0AVS\r\n" # define output variable def outputSelect(command): command = "0CO" + command + "\r\n" port.write(command) # print command # define input variable def inputSelect(command): command = "0CI" + command + "\r\n" port.write(command) # print command print "VAMS 0808 ssh interface V1.0 created by luke and matt :)" print "for a list of commands, type '?'" while True: command = raw_input ("select output channel: ") if command == "a": port.write(a) print "audio selected" elif command == "v": port.write(v) print "video selected" elif command == "av": port.write(av) print "audio & video selected" #select output channel elif int(command) >0 and int(command) <9: outputSelect(command) # print "output win" #select input channel inp = raw_input ("now select input channel: ") if int(inp) >0 and int(inp) <9: inputSelect(inp) # print "input win" elif command == "?": print "here are a list of commands:" print "a = select audio" print "v = select video" print "av = select audio and video" print "o = output" print "i = input" else: print "you've entered an invalid command." print "for a list of commands, type '?'"