Advertisement
Guest User

VAMS V1.0

a guest
Jan 7th, 2014
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. import serial
  2.  
  3. port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=3.0)
  4.  
  5. #serial strings
  6. #select audio
  7. a = "0ACS\r\n"
  8. #select video
  9. v = "0VCS\r\n"
  10. #select both
  11. av = "0AVS\r\n"
  12.  
  13.  
  14. # define output variable
  15. def outputSelect(command):
  16.     command = "0CO" + command + "\r\n"
  17.     port.write(command)
  18. #    print command
  19.    
  20. # define input variable
  21. def inputSelect(command):
  22.     command = "0CI" + command + "\r\n"
  23.     port.write(command)
  24. #    print command
  25.  
  26. print "VAMS 0808 ssh interface V1.0 created by luke and matt :)"
  27. print "for a list of commands, type '?'"
  28. while True:
  29.     command = raw_input ("select output channel: ")
  30.     if command == "a":
  31.         port.write(a)
  32.         print "audio selected"
  33.     elif command == "v":
  34.         port.write(v)
  35.         print "video selected"
  36.     elif command == "av":
  37.         port.write(av)
  38.         print "audio & video selected"
  39. #select output channel
  40.     elif int(command) >0 and int(command) <9:
  41.         outputSelect(command)
  42. #        print "output win"
  43. #select input channel
  44.         inp = raw_input ("now select input channel: ")
  45.         if int(inp) >0 and int(inp) <9:
  46.             inputSelect(inp)
  47. #            print "input win"
  48.     elif command == "?":
  49.         print "here are a list of commands:"
  50.         print "a = select audio"
  51.         print "v = select video"
  52.         print "av = select audio and video"
  53.         print "o = output"
  54.         print "i = input"
  55.     else:
  56.         print "you've entered an invalid command."
  57.         print "for a list of commands, type '?'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement