예제 #1
0
def rocky_send():
    print("rocky forward")
    rocky.forward(100, 2)
    print("rocky back")
    rocky.backward(100, 2)   
    print("rocky left")    
    rocky.turn_left(100, 2)
    print("rocky right")
    rocky.turn_right(100, 2)
    print("rocky stop")
    print("rocky set rgb color white")
    rocky.color("#ffffff")
    time.sleep(1)
    print("rocky set rgb color red")
    rocky.color("#ff0000")
def rocky_read():
    print("rocky color is:", rocky.color())
    print("rocky grey is:", rocky.grey('left'))
    print("rocky obstacle is:", rocky.is_obstacle_ahead())
    print("rocky light is:", rocky.light_intensity('left'))
예제 #3
0
codey.message("a")
codey.is_button('A')
codey.is_shaked()
codey.is_tilt('forward')
codey.sound_strength()
codey.light_strength()
codey.dail()
codey.gyro('pitch')
codey.time()
codey.reset_time()
codey.ir_send("A")
codey.ir_receive()

print("***codey APIS all succeed***")
# about rocky
rocky.color("#334455")
rocky.forward(50, 1)
rocky.backward(50, 1)
rocky.turn_left(50, 1)
rocky.turn_right(50, )
rocky.forward(50)
rocky.backward(50)
rocky.turn_left(50)
rocky.turn_right(50)
rocky.drive(50, 50)
rocky.turn_left_angle(15)
rocky.turn_right_angle(15)
rocky.stop()

rocky.is_obstacle_ahead()
rocky.is_color('red')
def color_id_test():
    print("color id test")
    while (True):
        print("color is " + rocky.color())
        time.sleep(1)