// Motor M3 reverse at full speed digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); analogWrite(ENB, 255);
Troubleshooting tips
switch (command) case 'F': // Forward motorLeft.run(FORWARD); motorRight.run(FORWARD); break; case 'B': // Backward motorLeft.run(BACKWARD); motorRight.run(BACKWARD); break; case 'L': // Turn Left motorLeft.run(BACKWARD); motorRight.run(FORWARD); break; case 'R': // Turn Right motorLeft.run(FORWARD); motorRight.run(BACKWARD); break; case 'S': // Stop motorLeft.run(RELEASE); motorRight.run(RELEASE); break;
The Arduino logic and motor power are completely isolated. You must connect an external power supply to the screw terminals labeled EXT_PWR . Best Practice for Robotics hw 130 motor control shield for arduino datasheet
Do not trust the silkscreen on cheap boards. Always verify with a multimeter, but the table above matches the standard "L298N Shield" reference design.
The HW-130 shield is widely available from online retailers:
4 DC Motor channels (or 2 Stepper Motor channels). // Motor M3 reverse at full speed digitalWrite(IN3,
– Declare AF_DCMotor motor3(3); and AF_DCMotor motor4(4); and set their speeds.
Many users damage their shields or Arduino boards because they ignore proper power supply practices. Follow these rules carefully.
| Stepper Wire | HW-130 Connection | |--------------|-------------------| | Coil A+ | M1 (A+) | | Coil A- | M2 (A-) | | Coil B+ | M3 (B+) | | Coil B- | M4 (B-) | Always verify with a multimeter, but the table
The HW-130 has a built-in mechanism to manage power effectively, but this is also the most common point of failure. Here is how to wire it correctly:
: This IC expands the Arduino's digital pins. It converts serial data from just three Arduino pins into eight parallel outputs to control the direction of the L293D chips, preserving other Arduino pins for sensors or communication. Critical Specifications
Install the (do not install V2, as V2 is designed for I2C-based shields). Example Code: Controlling a DC Motor
标签打印软件下载 | 条码打印软件使用教程 | BarTender经典案例 | 隐私条款 | 网站地图 | 关于我们