The HW-130 Motor Control Shield boasts an impressive array of features that make it an attractive option for Arduino enthusiasts. Some of the key features include:
void setup() // put your setup code here, to run once:
void setup() // Set all control pins to outputs pinMode(ENA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT);
AF_DCMotor motor(1); // Create motor object on channel 1 hw 130 motor control shield for arduino datasheet better
// Create a motor object connected to port M1 // Options: MOTOR1, MOTOR2, MOTOR3, MOTOR4 AF_DCMotor motor(1);
#include <AFMotor.h> #include <SoftwareSerial.h>
The easiest way to get started is to use the AFMotor library, which provides an abstraction layer for the shield. The HW-130 Motor Control Shield boasts an impressive
void setup() Serial.begin(9600); // set up Serial library at 9600 bps Serial.println("Motor test!");
void setup() stepper.setSpeed(30); // 30 rpm
void setup() // Start Bluetooth communication and the Serial Monitor for debugging BTSerial.begin(9600); Serial.begin(9600); MOTOR4 AF_DCMotor motor(1)
motor2.run(RELEASE); delay(500);
AF_Stepper stepper(200, 2); // 200 steps/revolution, motor port #2