from paco import Paco
from time import sleep

#SERIAL_PORT='/dev/tty.usbserial-A702U58D'
SERIAL_PORT='/dev/ttyUSB0'

if __name__ == '__main__':
    p = Paco(SERIAL_PORT)
    sleep(5)
    p.say("Hello I'm PACO")
    p.say("A digital companion")
    p.say("And a Fab Academy final project")
    p.beachlab()
    p.say("I come from Sitges Beach Lab")
    p.say("I'm a funny guy! My dad taught me many tricks!")
    p.smile()
    p.say("I can smile")
    p.grin()
    p.say("I can grin")
    p.sad()
    p.say("I can also look sad")
    p.say("But I'm so happy!")
    p.smile()
    dist = p.readDistance()
    dist = p.readDistance()
    p.say("I know you are %d centimeters away" % dist)
    p.say("I can look at you up and down")
    p.tilt(20)
    p.tilt(60)
    p.tilt(20)
    p.tilt(60)
    p.smile()
    p.tilt(40)
    p.say("I can rotate my body")
    p.pan(45)
    p.pan(120) 
    p.pan(90)
    p.say("I can light your desk too")
    p.setBrightness(255)
    p.setLed(9,0,255,0)
    p.say("Ok, you like yellow?")
    for i in range(0,9):
       p.setLed(i,255,180,0)
       sleep(.3)
    p.say("I can be programmed in Python and Javascript")
    p.grin()
    p.say("I can also take pictures")
    p.setLed(9,255,255,255)
    p.picture() 
    p.smile()
    p.setBrightness(0)
    p.say("Finally I have a web interface, so you can see what I see")
    p.say("I hope you all like me")
    p.say("Please teach me more tricks")
    p.showText('Thank you!')
    p.say("Thank you all for your time")
    p.logo()
    p.exit()

