Based on the pinout above, here is the truth table. To spin a motor, you set one direction pin HIGH and the other LOW. To brake, set both HIGH.
// HW-130 Motor Shield Pin Definitions #define ENA 5 // Speed for Motor A #define IN1 7 // Direction 1 #define IN2 8 // Direction 2#define ENB 6 // Speed for Motor B #define IN3 9 // Direction 1 #define IN4 10 // Direction 2
void setup() pinMode(ENA, OUTPUT); pinMode(ENB, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); hw 130 motor control shield for arduino datasheet
void loop() // Motor A Forward at 75% speed digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); analogWrite(ENA, 191); // 255 * 0.75
// Motor B Backward at 50% speed digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); analogWrite(ENB, 127); Based on the pinout above, here is the truth table
delay(2000);
// Stop both motors digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); delay(1000);void loop() // Motor A Forward at 75%
| Issue | Implication | |-------|-------------| | No thermal or current derating curves | Users often overload the L293D (600mA continuous, 1.2A peak per channel) because the datasheet doesn’t emphasize limits. | | Missing voltage drop specs | L293D drops ~1.4V–2V, reducing torque at low battery voltages – not explained. | | No flyback diode specification | While onboard diodes exist, no guidance on adding external Schottky diodes for inductive kickback. | | PWM frequency limits | Doesn’t state max PWM frequency (L293D works <5 kHz typically). Users may apply 20 kHz+ and get poor response. | | Schematic errors | Many clone datasheets have mismatched pin labels (e.g., swapping ENA/ENB). |
The HW-130 does not have dedicated servo headers, but you can connect signal wires to D9 and D10 (6–7.2V servos need separate external supply).