Exemplo n.º 1
0
    c1 = getchar()
    if ord(c1) != 0x1b:
        return c1
    c2 = getchar()
    if ord(c2) != 0x5b:
        return c1
    c3 = getchar()
    return chr(0x10 + ord(c3) - 65)  # 16=Up, 17=Down, 18=Right, 19=Left arrows


# End of single character reading
#======================================================================

speed = 30

agobo.init()

# main loop
try:
    while True:
        keyp = readkey()
        if keyp == 'w' or ord(keyp) == 16:
            agobo.forward(speed)
            print 'Forward', speed
        elif keyp == 'z' or ord(keyp) == 17:
            agobo.reverse(speed)
            print 'Reverse', speed
        elif keyp == 's' or ord(keyp) == 18:
            agobo.spinRight(speed)
            print 'Spin Right', speed
        elif keyp == 'a' or ord(keyp) == 19:
Exemplo n.º 2
0
# Agobo Motor Test
# Moves: Forward, Reverse, turn Right, turn Left, Stop - then repeat
# Press Ctrl-C to stop
#
# To check wiring is correct ensure the order of movement as above is correct
# Run using: sudo python motorTest.py


import agobo, time

speed = 80

agobo.init()

# main loop
try:
    while True:
        agobo.forward(speed)
        print 'Forward'
        time.sleep(3)
        agobo.reverse(speed)
        print 'Reverse'
        time.sleep(3)
        agobo.spinRight(speed)
        print 'Spin Right'
        time.sleep(3)
        agobo.spinLeft(speed)
        print 'Spin Left'
        time.sleep(3)
        agobo.stop()
        print 'Stop'