Exemplo n.º 1
0
def get_steven_to_talk():
    """Run the Ohbot routine
    Returns:
        Boolean True or False depending on whether run successfully or not
    """

    try:
        # Reset Ohbot

        ohbot.reset()

        # Switch the speech synthesizer to epseak
        ohbot.setSynthesizer("espeak")

        # Set the voice to english West Midlands accent medium speed.

        ohbot.setVoice("-ven+f2 -s130")

        # Set eyes to red
        ohbot.eyeColour(10, 0, 0)

        ohbot.wait(0.5)

        # Say something
        ohbot.say("Good Evening", True, False, False, 0)
        ohbot.wait(0.5)
        #ohbot.say("Who have we got here",True, False, False,0)
        #ohbot.wait(0.5)
        ohbot.say("I'm the late great Mary Webb ", True, False, False, 0)
        ohbot.wait(0.5)
        ohbot.say("I love children ", True, False, False, 0)
        ohbot.wait(0.5)
        ohbot.say("For supper", True, False, False, 0)
        ohbot.wait(0.5)
        #ohbot.say("Woooahhhh woooahhha",True, False, False,0)
        #ohbot.wait(0.5)
        # Wait a few seconds for the motors to move

        ohbot.wait(2)

        # Move head left to right
        ohbot.move(ohbot.HEADTURN, 4, 1)
        ohbot.wait(0.5)
        ohbot.move(ohbot.HEADTURN, 6, 1)
        ohbot.wait(0.5)
        ohbot.move(ohbot.HEADTURN, 5, 1)
        ohbot.wait(0.5)
        ohbot.eyeColour(0, 10, 0)
        ohbot.wait(0.5)
        ohbot.move(ohbot.HEADNOD, 7, 1)
        ohbot.wait(0.5)
        ohbot.move(ohbot.HEADNOD, 1, 1)
        ohbot.wait(0.5)
        ohbot.move(ohbot.EYETURN, 9, 1)
        ohbot.wait(0.5)
        ohbot.move(ohbot.EYETURN, 1, 1)
        ohbot.wait(0.5)
        ohbot.move(ohbot.EYETURN, 5, 1)
        ohbot.wait(0.5)
        ohbot.say("Take one sweet.", True, False, False, 0)
        ohbot.wait(0.5)
        ohbot.say("At your own risk", True, False, False, 0)
        ohbot.wait(0.5)
        ohbot.say("Don't forget to brush your teeth", True, False, False, 0)
        ohbot.wait(0.5)
        ohbot.say("Happy Halloween", True, False, False, 0)
        ohbot.wait(0.5)
        ohbot.reset()
        # close ohbot at the end.
        ohbot.wait(0.5)
        ohbot.close()
        ohbot.wait(0.5)
        return True
    except:
        return False
Exemplo n.º 2
0
        sleep(0.2)
        ohbot.move(ohbot.LIDBLINK, 10)
        #wait for a random amount of time for realistic blinking
        sleep(randint(0, 4))


#start up sequence resets to mid position, sets the eyes to blue then goes to sleep
ohbot.reset()
ohbot.eyeColour(0, 0, 10)
sleep(1.0)
ohbot.eyeColour(0, 0, 0)
ohbot.move(ohbot.HEADNOD, 0)
ohbot.move(ohbot.LIDBLINK, 0)
sleep(2.0)
#close to turn the motors off
ohbot.close()

while (True):
    #get seconds and minutes into strings
    s = strftime("%S", localtime())
    m = strftime("%M", localtime())
    #set this to False for testing to make Ohbot speak continuously
    everyQuarterHour = True
    if ((everyQuarterHour == False) or
        ((everyQuarterHour == True) and
         (m == "00" or m == "15" or m == "30" or m == "45") and m != lastm)):
        lastm = m
        h = strftime("%H", localtime())
        hi = int(h)
        say = "Wow the time is "
        if (m == "15"):
Exemplo n.º 3
0
def on_closing():
    ohbot.reset()
    ohbot.wait(1)
    ohbot.close()
    win.destroy()