This will be my first engineering post, as I work on merging my interest in imagery with electrical engineering
I’m having an issue with my new Arduino Uno and the Arduino Motor Shield R3.
UPDATE: I believe the problem is fixed with some help from the Arduino board. There was a mistake in the code where I didn’t set the direction pins to output. Also it looks like I might have a power problems as well that will hopefully be solved with a new battery on order. I also started a project page for updates on this.
Here is a link to the video showing what is going.
Here is the code
/*
Motor Test Drive
*/
//Motor A Config
const int
PWM_A = 3,
DIR_A = 12,
BRAKE_A = 9;
//Motor A Config
const int
PWM_B = 11,
DIR_B = 13,
BRAKE_B = 8;
void setup()
{
pinMode(PWM_A, OUTPUT);
pinMode(BRAKE_A, OUTPUT);
pinMode(DIR_A, OUTPUT);
pinMode(PWM_B, OUTPUT);
pinMode(BRAKE_B, OUTPUT);
pinMode(DIR_B, OUTPUT);
Serial.begin(9600);
digitalWrite(BRAKE_A, LOW); // setting brake LOW disable motor brake
digitalWrite(DIR_A, HIGH); // setting direction to HIGH the motor will spin forward
digitalWrite(BRAKE_B, LOW); // setting brake LOW disable motor brake
digitalWrite(DIR_B, HIGH); // setting direction to HIGH the motor will spin forward;
//int speed = 0;
for (int i = 1; i < 255; i++)
{
analogWrite(PWM_A, i);
delay(50);
}
analogWrite(PWM_A, 0);
delay(1000);
for (int i = 1; i < 255; i++)
{
analogWrite(PWM_B, i);
delay(50);
}
analogWrite(PWM_B, 0);
delay(1000);
for (int i = 1; i < 255; i++)
{
analogWrite(PWM_A, i);
analogWrite(PWM_B, i);
delay(50);
}
analogWrite(PWM_A, 0);
analogWrite(PWM_B, 0);
}
void loop()
{
}