Reference

API Description

/**
   * @fn DFRobot_N20Motor
   * @brief Constructor, pins can be set here or by begin().
   * @param inA INA pin number.
   * @param inB INB pin number.
   */
  DFRobot_N20Motor(uint8_t inA = 0xFF, uint8_t inB = 0xFF);

  /**
   * @fn begin
   * @brief Initialize the motor control pins.
   * @param inA INA pin number. When set to 0xFF, keep constructor value.
   * @param inB INB pin number. When set to 0xFF, keep constructor value.
   * @return bool
   * @retval true Init success.
   * @retval false Init failed because pin is invalid.
   */
  bool begin(uint8_t inA = 0xFF, uint8_t inB = 0xFF);

  /**
   * @fn setSpeed
   * @brief Set motor speed and direction in one API.
   * @param speed Speed range: -255~255.
   * @n speed > 0: forward, speed < 0: backward, speed == 0: stop.
   */
  void setSpeed(int16_t speed);

Was this article helpful?

ON THIS PAGE

TOP