-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled1.py
More file actions
49 lines (32 loc) · 1.03 KB
/
Untitled1.py
File metadata and controls
49 lines (32 loc) · 1.03 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# coding: utf-8
# # Gesture Control Project
#
# ## Semester 1 (2018-2019)
# ## Python Code
#
# In[ ]:
import serial #Serial imported for Serial communication
import time #Required to use delay functions
import pyautogui
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 1:
print("Started")
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)
print("Play/Pause")
if 'Rewind' in incoming:
pyautogui.hotkey('ctrl', 'left')
print("Rewind")
if 'Forward' in incoming:
pyautogui.hotkey('ctrl', 'right')
print("Forward")
if 'Vup' in incoming:
pyautogui.hotkey('ctrl', 'down')
print("Vup")
if 'Vdown' in incoming:
pyautogui.hotkey('ctrl', 'up')
print("Vdown")
incoming = "";