Ejemplo n.º 1
0
def blinkLids():
    while (blinking):
        ohbot.move(ohbot.LIDBLINK, 0)
        sleep(0.2)
        ohbot.move(ohbot.LIDBLINK, 10)
        # wait for a random amount of time for realistic blinking
        sleep(randint(0, 4))
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
# this is called on a separate thread to blink the eyes while running
def blinkLids():
    while (blinking):
        ohbot.move(ohbot.LIDBLINK, 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 = False  #make True for every 15 mins
    if ((everyQuarterHour == False) or
        ((everyQuarterHour == True) and
         (m == "00" or m == "15" or m == "30" or m == "45") and m != lastm)):
        lastm = m
Ejemplo n.º 7
0
def warmUp(motor, movePosition, speed):
    ohbot.move(motor, movePosition, speed)
    ohbot.wait(WAITTIME)
Ejemplo n.º 8
0
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())
Ejemplo n.º 9
0
def endAndRest():
    ohbot.reset()
    ohbot.wait(1)
    ohbot.move(3, 0, 2)
Ejemplo n.º 10
0
def blink():
    ohbot.move(EYELIDS, 0, 10)
    ohbot.wait(.2)
    ohbot.move(EYELIDS, 7, 10)
    ohbot.wait(.4)
Ejemplo n.º 11
0
from ohbotMac import ohbot

ohbot.reset()
ohbot.wait(2)

ohbot.setVoice("Samantha")

ohbot.wait(1)

ohbot.move(4, 7, 10)
ohbot.move(5, 7, 10)

ohbot.reset()
ohbot.wait(1)

ohbot.close()
Ejemplo n.º 12
0
# 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)