Skip to content

Instantly share code, notes, and snippets.

@psr1428
Created June 25, 2019 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psr1428/a11e5f958b36db96e9bdd08ae2b2fb0c to your computer and use it in GitHub Desktop.
Save psr1428/a11e5f958b36db96e9bdd08ae2b2fb0c to your computer and use it in GitHub Desktop.
Python leap motion tech
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