I'm trying to power 4 different 25mm DC Motors. Ive tried multiple adafruit Libraries and associated tutorials and can get the motors to run in one direction at a speed using various setspeed
and pwm library functions. Any command for releasing or changing direction of the motors doesn't work with either the Adafruit Motor Library Version 1 or Version 2 or the Adafruit Shield master library. I would love to know simply what pins I can use to control the H-bridge for each of the 4 motors and bypass the libraries but I can't figure it out from the schematics.
Here is Motor Shield schematic.
Here is some sample modified code from adafruit examples:
This is attempt using Adafruit V1 Library "AFMotor.H"
#include <AFMotor.h>
AF_DCMotor motorFL(1);
void setup() {
Serial.begin(9600);
motorFL.setSpeed(0);
motorFL.run(RELEASE);
}
void loop() {
motorFL.run(RELEASE);
motorFL.run(BACKWARD);
motorFL.setSpeed(50);
delay(1000);
motorFL.run(RELEASE);
motorFL.run(FORWARD);
delay(1000);
motorFL.run(RELEASE);
motorFL.run(BACKWARD);
delay(1000);
motorFL.run(RELEASE);
}
This coding results in the correct motor(1-4) moving at a certain direction at the setSpeed command speed.
Next i tried the Adafruit V2 library "Adafruit_MotorShield"
#include <Wire.h>
#include <Adafruit_MotorShield.h>
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Adafruit Motorshield v2 - DC Motor test!");
AFMS.begin(); // create with the default frequency 1.6KHz
myMotor->setSpeed(0);
myMotor->run(FORWARD);
myMotor->run(RELEASE);
}
void loop() {
myMotor->run(FORWARD);
myMotor->setSpeed(100);
delay(1000);
myMotor->run(RELEASE);
myMotor->run(FORWARD);
delay(1000);
myMotor->setSpeed(100);
myMotor->run(FORWARD);
delay(1000);
myMotor->run(RELEASE);
myMotor->run(FORWARD);
delay(1000);
}
The V2 code does nothing for my motors.
Ive dug into the libraries and cant find any tutorials regarding specifically how to set up H-Bridge or PWM speed control of each individual motor. I'm sure the schematic has something on it to help but I cant find it. If somebody could find and explain a command for setting the InA/B or EnA/B of the H-bridge that would be wonderful.