import subprocess
import time
import serial
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
time.sleep(2)
print('Готово! Вводи пароль на кнопках...')
while True:
line = ser.readline().decode('utf-8', errors='ignore').strip()
if line == 'PLAY':
print('ПАРОЛЬ ВЕРНЫЙ! ОТКРЫВАЮ ВИДЕО...')
subprocess.Popen(['xdg-open', 'video.mp4'])
time.sleep(2)