-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpython Script.py
More file actions
29 lines (19 loc) · 866 Bytes
/
python 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
import serial #Serial imported for Serial communication
import time #Required to use delay functionss
import pyautogui#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
while True:
incoming = str (ArduinoSerial.readline()) #read the serial data and print it as line
print(incoming)
if 'Play/Pause' in incoming:
pyautogui.typewrite(['space'], 0.2)
if 'Rewind' in incoming:
pyautogui.hotkey('ctrl', 'left')
if 'Forward' in incoming:
pyautogui.hotkey('ctrl', 'right')
if 'Vup' in incoming:
pyautogui.hotkey('ctrl', 'down')
if 'Vdown' in incoming:
pyautogui.hotkey('ctrl', 'up')
incoming = "";