Skip to content

Instantly share code, notes, and snippets.

@rainey
Last active February 15, 2023 16:37
Show Gist options
  • Select an option

  • Save rainey/6763d315c3e2890f0a6a96ba1f2e5d29 to your computer and use it in GitHub Desktop.

Select an option

Save rainey/6763d315c3e2890f0a6a96ba1f2e5d29 to your computer and use it in GitHub Desktop.
#requires pyserial: pip install pyserial
# Controls:
# Monoprice 3G SDI 4x1 Switch
# Product # 10320
# UPC # 670541339947
import serial
import time
# channel should be 1 to 4
def switch_to(ser_obj, channel):
# Basically just sending ascii 1-4 + CR
ser_obj.write(int(48+channel).to_bytes(1, "little"))
ser_obj.write(int(13).to_bytes(1, "little"))
## Simple demo to cycle until interrupted
if __name__ == "__main__":
ser = serial.Serial("/dev/ttyUSB3", 9600 )
i = 0
while True:
switch_to(ser, 1+ (i % 4))
time.sleep(2)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment