from itertools import cycle
from subprocess import *
from os import getcwd
cwd = getcwd()

def run_cmd(cmd):
    process = Popen(cmd.split(), stdout=PIPE)
    output = process.communicate()[0]
    return output

def backlight():
    alternator = cycle((0,1))
    backlight = cwd + "/backlight.sh "+ str(next(alternator))         
    print backlight
    run_cmd(backlight)
    
