# pc_control.
py
import serial
import sys
import time
from pynput import keyboard
ser = [Link]('COM3', 9600, timeout=0.1) # change COM port
def send(ch):
[Link]([Link]())
print("sent:", ch)
def on_press(key):
try:
if key == [Link]:
send('F')
elif key == [Link]:
send('B')
elif key == [Link]:
send('L')
elif key == [Link]:
send('R')
elif hasattr(key, 'char'):
ch = [Link]()
if ch == 'u':
send('U')
elif ch == 'd':
send('D')
elif ch == 'o':
send('O')
elif ch == 'c':
send('C')
elif ch == 's':
send('S')
except Exception as e:
print("err", e)
with [Link](on_press=on_press) as listener:
[Link]()