def focus(): ohbot.move(ohbot.HEADNOD, 0, 3) ohbot.wait(.2) ohbot.move(EYELIDS, 0, 10) ohbot.wait(.8) ohbot.move(ohbot.HEADNOD, 7, 10) ohbot.wait(.3) ohbot.move(EYELIDS, 7, 10) ohbot.wait(1) ohbot.move(ohbot.HEADNOD, 5, 3) ohbot.wait(.3)
def yes(): ohbot.move(ohbot.HEADNOD, 0, 10) ohbot.wait(.1) ohbot.move(ohbot.HEADNOD, 10, 10) ohbot.wait(.5) ohbot.move(ohbot.HEADNOD, 5, 10) ohbot.wait(.1)
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)
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)
def warmUp(motor, movePosition, speed): ohbot.move(motor, movePosition, speed) ohbot.wait(WAITTIME)
NECK = 1 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
def randomMotion(): "This function makes a random movement for Ohbot to perform, and then chooses a random wait time after the movement" ohbot.move(random.randint(0, 6), random.randint(0, 9), random.randint(1, 10)) ohbot.wait(getRandomDecimal())
def randomMotion(): "This function makes a random movement for Ohbot to perform, and then chooses a random wait time after the movement" ohbot.move(random.randint(0, 6), random.randint(0, 9), 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:
def endAndRest(): ohbot.reset() ohbot.wait(1) ohbot.move(3, 0, 2)
def blink(): ohbot.move(EYELIDS, 0, 10) ohbot.wait(.2) ohbot.move(EYELIDS, 7, 10) ohbot.wait(.4)
def chooseShower(): choice = random.randint(1, 2) 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")
# import the ohbot module from ohbotMac import 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)