Skip to content

Instantly share code, notes, and snippets.

@AncientJames
Created November 9, 2025 04:34
Show Gist options
  • Select an option

  • Save AncientJames/6ce33ede918421ecdaa58c387bf24cb9 to your computer and use it in GitHub Desktop.

Select an option

Save AncientJames/6ce33ede918421ecdaa58c387bf24cb9 to your computer and use it in GitHub Desktop.
A python program for controlling the onscreen menu on an Anybeam Up projector over its serial connection.
import serial
import keyboard
def main():
port = 'COM22'
baudrate = 115200
print('Y: toggle OSD')
print('z: up')
print('y: enter')
print('x: down')
try:
ser = serial.Serial(port, baudrate, timeout=1)
except serial.SerialException as e:
print(f"Failed to connect: {e}")
return
try:
while True:
event = keyboard.read_event()
if event.event_type == keyboard.KEY_DOWN:
key = event.name
if key == 'esc':
break
if len(key) == 1:
char_byte = ord(key)
packet = [0xFF, ord('W'), ord('I'), char_byte]
checksum = (sum(packet)+1) % 256
packet.append(checksum)
ser.write(bytes(packet))
finally:
ser.close()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment