# Set baud and port
SERIAL_PORT = "/dev/ttyACM3"
BAUD_RATE = 115200 

import serial
import subprocess

sp = serial.Serial(SERIAL_PORT, BAUD_RATE, timeout = 5)
sp.flush()

print ("GIMP launcher")

while(1):                       
    response = sp.read(1)       # get one byte
    if response == "O":
        print "Waiting for a button press."
    elif response == ":":       # if received :, execute gimp command in bash
        print "Update!!"
	res = subprocess.check_output(["gimp"])
    else:
        print "Still waiting."
