void setMotor(int speed, bool reverse) digitalWrite(M1_DIR, reverse ? HIGH : LOW); analogWrite(M1_PWM, constrain(speed, 0, 255));
Unlike its more powerful successor (e.g., L298N-based shields), the HW-130 focuses on low-voltage, low-current applications where simplicity and direct Arduino pin mapping are paramount.
#include <AFMotor.h> AF_DCMotor motor1(1); // M1 AF_DCMotor motor2(3); // M3