from PhilipsHue import PhilipsHue
from ArduinoInterface import ArduinoInterface
import time

hue_value = 60000
brightness = 200
saturation = 150
sense_threshold = 700

def setLampDefaultState():
    myhue.TurnOn(1, True)
    myhue.TurnOn(2, True)

    # Pinkish Color.
    myhue.setHue(1, hue_value)
    myhue.setHue(2, hue_value)

    myhue.setBrightness(1, brightness)
    myhue.setBrightness(2, brightness)

    setDefaultSaturation()

def setDefaultSaturation():
    myhue.setSaturation(1, 0)
    myhue.setSaturation(2, 0)

def handleTap():
    while True:
        pressureIntensity = pressureSensor.getSensorData()
        print pressureIntensity
        if pressureIntensity > sense_threshold:
            myhue.setSaturation(1, saturation)
            time.sleep(0.25)
            myhue.setSaturation(2, saturation)
            time.sleep(0.5)

            setDefaultSaturation()
            return

pressureSensor = ArduinoInterface()
myhue = PhilipsHue()
setLampDefaultState()

while True:
    handleTap()
