Created
June 25, 2019 05:36
-
-
Save psr1428/a11e5f958b36db96e9bdd08ae2b2fb0c to your computer and use it in GitHub Desktop.
Python leap motion tech
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import time | |
import pyautogui | |
ArduinoSerial = serial.Serial('com7',9600) #Create Serial port object called arduinoSerialData | |
time.sleep(2) #wait for 2 seconds for the communication to get established | |
while 1: | |
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('Fn', 'up') | |
if 'Vdown' in incoming: | |
pyautogui.hotkey('Fn', 'down') | |
incoming = ""; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment