コード例 #1
0
def shakeHead():
    "This function shakes head and says no three times"
    ohbot.say("NO No No", False)
    ohbot.move(NECK, 0, 3)
    ohbot.wait(.2)
    ohbot.move(NECK, 10, 10)
    ohbot.wait(.3)
    ohbot.move(NECK, 5, 5)
    ohbot.wait(1)
コード例 #2
0
def nodHead():
    "This function nods head and says yes three times"
    ohbot.say("Yes Yes Yes", False)
    ohbot.move(ohbot.HEADNOD, 0, 3)
    ohbot.wait(.2)
    ohbot.move(ohbot.HEADNOD, 10, 10)
    ohbot.wait(.3)
    ohbot.move(ohbot.HEADNOD, 5, 5)
    ohbot.wait(1)
コード例 #3
0
        # now that eyes are open start blinking on a different thread
        blinking = True
        t = threading.Thread(target=blinkLids, args=())
        t.start()

        # turn the head to each side then back to centre
        sleep(0.5)
        ohbot.move(ohbot.HEADTURN, 10)
        sleep(0.5)
        ohbot.move(ohbot.HEADTURN, 0)
        sleep(0.5)
        ohbot.move(ohbot.HEADTURN, 5)

        # set hdmiAudio to True here if you are using hdmiAudio and speech is missing at beginning of each phrase
        ohbot.say(say, untilDone=False, lipSync=True, hdmiAudio=False)

        # swivel eyes side to side 5 times
        for i in range(0, 5):
            ohbot.move(ohbot.EYETURN, 10, 10)
            sleep(0.1)
            ohbot.move(ohbot.EYETURN, 0, 10)
            sleep(0.1)

        # eye swivel back to centre
        ohbot.move(ohbot.EYETURN, 5, 10)

        # go to sleep position and turn eyes off
        sleep(3)
        blinking = False
        # wait a second for the thread to stop
コード例 #4
0
ファイル: warmup.py プロジェクト: davebza/ohBot
def giveInfo(motor):
    motorList = ["neck", "eye balls", "eye lids", "top lip", "bottom lip", "eye sockets"]
    currentMotor = motorList[motor - 1]
    ohbot.say("checking" + currentMotor)
コード例 #5
0
ファイル: warmup.py プロジェクト: davebza/ohBot
EYEBALLS = 2
EYELIDS = 3
TOPLIP = 4
BOTTOMLIP = 5
EYESOCKETS = 6

MOVESPEED = 10
WAITTIME = 1

#make a list of motors:
motors = [NECK, EYEBALLS, EYELIDS, TOPLIP, BOTTOMLIP, EYESOCKETS]

# Reset Ohbot
ohbot.reset()
ohbot.wait(WAITTIME)

ohbot.say("Warm up time. I'm going to check all my motors one by one.")

# for motor in motors:
#     giveInfo(motor)
#     warmUp(motor, 1, MOVESPEED)
#

ohbot.say("Warm up complete. I'm good to go.")
yes()

# Reset Ohbot
ohbot.reset()
ohbot.wait(WAITTIME)
#close to exit
ohbot.close()
コード例 #6
0
ファイル: talkie.py プロジェクト: davebza/ohBot
               random.randint(1, 10))
    ohbot.wait(getRandomDecimal())


def getRandomDecimal():
    """This function creates a random decimal between 0.1 and 0.9 for the wait times between moves"""
    decimal = float(random.randrange(1, 9) / 10)
    return decimal


ohbot.reset()
ohbot.wait(1)

ohbot.setVoice("Samantha")

ohbot.say("Hi sean and mummy and daddy")
ohbot.say("i love you")
ohbot.say("do you love me yes or no ")

love = input("write your answer")

if love == "yes":
    ohbot.say("yes yes yes i want to marry you")

elif love == "no":
    ohbot.say("moo moo moo moo    no no nope")
else:
    ohbot.say("I don't understand")

listOfMoves = [i for i in range(random.randint(1, 20))]
コード例 #7
0
ファイル: showerTime.py プロジェクト: davebza/ohBot
    print(choice)

    if choice == 1:
        showerFirst = "Michelle"
    elif choice == 2:
        showerFirst = "Sean"

    return showerFirst


ob.reset()
ob.wait(1)

ob.setVoice("Samantha")

ob.say("Ah I'm awake. Did you need me?")

listOfMoves = [i for i in range(random.randint(40, 60))]
print(len(listOfMoves))

for move in listOfMoves:
    chooseBigOrSmall()

ob.reset()
ob.wait(1)

ob.say("Hi, Sean Hi Michelle")

ob.say("Should I choose who will shower first tonight?")
ob.wait(1)
コード例 #8
0
ファイル: wikiquote.py プロジェクト: davebza/ohBot
print("Sending the request")

theList = wikiquotes.get_quotes("Musk", "English")

if theList:

    ohbot.reset()
    ohbot.wait(1)

    print("Success")
    print(theList)
    print(len(theList))
    text = theList[random.randint(0, len(theList) - 1)]
    print(text)

    ohbot.say(text)
    ohbot.wait(1)

else:
    print("Problem connecting to the server")

print("Sending the second request")
quoteOfTheDay = wikiquotes.quote_of_the_day("English")
newText = quoteOfTheDay[0]
print(newText)
print(type(newText))
#
# ohbot.say(str(newText))

ohbot.close()
コード例 #9
0
ファイル: helloWorld.py プロジェクト: davebza/ohBot
# Reset Ohbot

ohbot.reset()

# Move turn ohbot's head and eyes.
ohbot.move(1, 2)
ohbot.move(3, 1)

# Wait a few seconds for the motors to move

ohbot.wait(2)

# Move head back to the centre and say "Hello World"
ohbot.move(1, 5, 1)
ohbot.say("")

#Slowly increase the brightness of the eyes.

for x in range(0, 10):
    ohbot.eyeColour(x, x, x)
    ohbot.wait(0.1)

    ohbot.eyeColour(0, 0, 0)
    ohbot.wait(0.2)

ohbot.move(1, 5, 1)
ohbot.wait(1)

ohbot.say("Now I am running in python you know", False)