Skip to content

Instantly share code, notes, and snippets.

Last active Feb 13, 2016
What would you like to do?
Gesture based TV remote control
#!/usr/bin/env python
import skywriter
import signal
from os import system
import time
some_value = 5000
last_airwheel = 0
delay = 5000
def flick(start,finish):
if(start == "north" and finish == "south"):
print "Volume: down"
elif(start == "south" and finish == "north"):
print "Volume: up"
system("irsend SEND_ONCE TV KEY_VOLUMEUP")
elif(start == "west" and finish == "east"):
print "Channel: prev"
system("irsend SEND_ONCE Digibox KEY_CHANNELDOWN")
elif(start == "east" and finish == "west"):
print "Channel: next"
system("irsend SEND_ONCE Digibox KEY_CHANNELUP")
print "Invalid"
def spinny(delta):
global some_value
global last_airwheel
global delay
some_value += delta
if some_value < 0:
some_value = 0
if some_value > 10000:
some_value = 10000
now = int(round(time.time() * 1000))
if(now - last_airwheel > delay):
print("TV & Digibox: power")
system("irsend SEND_ONCE TV KEY_POWER")
system("irsend SEND_ONCE Digibox KEY_POWER")
last_airwheel = now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment