Introduction to API

API or Application Programming Interface refers to a number of preset programs. Before utilization, it is required to import API library:

set_led(mode, R, G, B)

Set up LED lights

  • Parameters
    • mode – 1 - Set LED light color. 2 - Set the LED light to blink.
    • R – (int) 0 ~ 255
    • G – (int) 0 ~ 255
    • B – (int) 0 ~ 255

get_firmware_version

Get firmware version number

get_motors_current

Get the total current of the motor

get_battery_info

Read battery information

  • Return list : [battery_data, battery_1_voltage, battery_2_voltage]. battery_data:A string of length 6, represented from left to right: bit5, bit4, bit3, bit2, bit1, bit0. bit5 : Battery 2 is inserted into the interface 1 means inserted, 0 is not inserted. bit4 : Battery 1 is inserted into the interface, 1 means inserted, 0 is not inserted. bit3 : The adapter is plugged into the interface 1 means plugged in, 0 not plugged in. bit2 : The charging pile is inserted into the interface, 1 means plugged in, 0 is not plugged in. bit1 : Battery 2 charging light 0 means off, 1 means on. bit0 : Battery 1 charging light, 0 means off, 1 means on. battery_1_voltage : Battery 1 voltage in volts. battery_2_voltage : Battery 2 voltage in volts.

go_ahead(go_speed, timeout=5)

Control the car to move forward. with a default motion time of 5 seconds.

  • Parameters
    • go_speed – (int) 1 ~ 127 is forward.The smaller the value, the smaller the speed
    • timeout - (int): default 5 s.

retreat(back_speed, timeout=5)

Control the car back. with a default motion time of 5 seconds.

  • Parameters
    • back_speed – (int) 1 ~ 127 is backward.The smaller the value, the smaller the speed
    • timeout - (int): default 5 s.

pan_left(pan_left_speed, timeout=5)

Control the car to pan to the left. with a default motion time of 5 seconds.

  • Parameters
    • pan_left_speed – (int) 1 ~ 127.The smaller the value, the smaller the speed
    • timeout - (int): default 5 s.

pan_right(pan_right_speed, timeout=5)

Control the car to pan to the right. with a default motion time of 5 seconds.

  • Parameters
    • pan_right_speed – (int) 1 ~ 127.The smaller the value, the smaller the speed
    • timeout - (int): default 5 s.

clockwise_rotation(rotate_right_speed, timeout=5)

Control the car to rotate clockwise. with a default motion time of 5 seconds.

  • Parameters
    • rotate_right_speed – (int) 1 ~ 127.The smaller the value, the smaller the speed
    • timeout - (int): default 5 s.

counterclockwise_rotation(rotate_left_speed)

Control the car to rotate counterclockwise

  • Parameters
    • rotate_left_speed – (int) 1 ~ 127.The smaller the value, the smaller the speed
    • timeout - (int): default 5 s.

stop()

stop motion.

restore()

Motor stall recovery


← Previous Page | Next Section →

results matching ""

    No results matching ""