IBB

All Itty Bitty Buggy extension properties in the library depend on the Buggy extension package. Please import Buggy before use.

import buggy

The support firmware of Itty Bitty Buggy is “Buggy”. All float type or the valid string float type are directly converted into int type in actual operation. For example, 2.3 is equivalent to 2, and '2.6' is equivalent to 2.

1 Buggy moves forward/backward

buggy.bot_car_forward(direction, speed)
time.sleep(delay)
buggy.bot_car_forward(direction, 0)
"""
    direction : control buggy to move forward/backward, 1 for forward, 0 for backward
    speed : default speed is 255r/min
    delay : the duration time of moving,default is 3s
    Parameter type :  port, speed, delay support int, float or pure numeric strings
"""

2 Buggy turns left/right

buggy.bot_car_turn(direction, speed)
time.sleep(delay)
buggy.bot_car_forward(direction, 0)
"""
    direction : control buggy to turn left/right, 0 for left, 1 for right
    speed : default turning speed is 255r/min
    delay : the duration time of turning,default is 3s
    Parameter type :  port, speed, delay support int, float or pure numeric strings
"""

3 Buggy motor speed

buggy.bot_motor_control(ports, speed)
"""
    ports : Select the port of motor (1 for A, 2 for B and 3 for AB)
    speed : default speed is 255r/min
    Parameter type :  port, speed, delay support int, float or pure numeric strings
"""

4 Stop the Buggy motor

buggy.bot_motor_stop(ports)
"""
    ports : Motor port (1 for A, 2 for B and 3 for AB)
    Parameter type :  port, speed, delay support int, float or pure numeric strings

5 Buggy LED color

buggy.botLEDColor(ports, color)
"""
    ports : LED port (1 for A, 2 for B)
    color : LED color parameter,default is '#62f1e5' (color hex string)
    Parameter type :  port supports int, float or pure numeric strings, color supports color hex string.
"""

6 Buggy plays tones

buggy.bot_buzzer_pitch(beat)
time.sleep(delay)
buggy.bot_buzzer_pitch(0)
"""
    beat : musical tones(C4、D4、E4、F4、G4、A4、B4、C5、D5、E5、F5、G5、A5、B5、C6、D6、E6、F6、G6、A6、B6), default is C4, numeric value is 262
    delay : buzzer play time, default is 3s
    Parameter type :  beat, delay support int, float or pure numeric strings
"""

7 Buggy plays song

buggy.bot_buzzer_song(type)
"""
    type : type of music, default is 1 
    Parameter type : type supports int, float or pure numeric strings
"""

8 Buggy buzzer stops

buggy.bot_buzzer_stop()

9 Buggy does line following

buggy.bot_find_line(color, speed)
"""
    color : color type, default is 1 
    speed : default is 255r/min
    Parameter type : color, speed support int, float or pure numeric strings
"""

10 Buggy stops line following

buggy.bot_find_stop()

11 Buggy does color recognition

buggy.bot_judge_color(ports, color)
"""
    ports : grayscale sensor port (1 for A, 2 for B)
    color : color type, default is 1 {red (1), green (2), blue (3), yellow (4), purple (5), cyan (6), white (7), black (8)} 
    return value : the return value is bool, only tells True or False
    Parameter type : port, color support int, float or pure numeric strings
"""

12 Buggy detects grayscale

buggy.bot_get_gray(ports, color)
"""
    ports : grayscale sensor port (1 for A, 2 for B)
    color : set the LED color, default is 1 {red (1), green (2), blue (3), none (0)}
    return value : the return value is float  
    Parameter type : port, color support int, float or pure numeric strings
"""