- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpython Script.py
More file actions
Latest commit
29 lines (19 loc) · 866 Bytes
/
Copy pathpython Script.py
File metadata and controls
29 lines (19 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
importserial#Serial imported for Serial communication
importtime#Required to use delay functionss
importpyautogui#required for autmating the input in behalf of the user
ArduinoSerial=serial.Serial('COM4',9600) #Create Serial port object called arduinoSerialData
time.sleep(2) #wait for 2 seconds for the communication to get established
whileTrue:
incoming=str (ArduinoSerial.readline()) #read the serial data and print it as line
print(incoming)
if'Play/Pause'inincoming:
pyautogui.typewrite(['space'], 0.2)
if'Rewind'inincoming:
pyautogui.hotkey('ctrl', 'left')
if'Forward'inincoming:
pyautogui.hotkey('ctrl', 'right')
if'Vup'inincoming:
pyautogui.hotkey('ctrl', 'down')
if'Vdown'inincoming:
pyautogui.hotkey('ctrl', 'up')
incoming="";