Пример #1
0
def rocky_read():
    print("rocky color is:", rocky.get_color()) # not a demand 
    print("red value is:", rocky.red())
    print("green value is:", rocky.green())
    print("blue value is:", rocky.blue())    
    print("rocky grey is:", rocky.grey())
    print("rocky obstacle is:", rocky.is_obstacle_ahead())
    print("rocky light is:", rocky.light_strength())
    print("rocky light reflect is:", rocky.reflection_strength()) 
    print("rocky ir reflect is:", rocky.ir_reflection_strength()) 
    print("rocky left motor current is ", rocky.motor_current('left'))
    rocky.forward(100)
    time.sleep(1)
    print("rocky left motor current is ", rocky.motor_current('left'))
    rocky.stop()
    print("")
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.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')
rocky.red()
rocky.green()
rocky.blue()
rocky.reflection_strength()
rocky.light_strength()
rocky.ir_reflection_strength()
rocky.grey()
print("***rocky APIS all succeed***")


codey.on_button('A', call_back) 
def color_is_obstacle_ahead_test():
    print("is_obstacle_ahead test")
    for i in range(10):
        print("is_obstacle_ahead %d" % rocky.is_obstacle_ahead())
        time.sleep(1)