Skip to content

Instantly share code, notes, and snippets.



Created Jun 25, 2019
What would you like to do?
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
You can’t perform that action at this time.