How Do I Run Two Motors Same Time WIth Arduino Motor Shied R3? Can I See Code Please.
Adruino Mega
Thank You
How Do I Run Two Motors Same Time WIth Arduino Motor Shied R3? Can I See Code Please.
Adruino Mega
Thank You
It's explained here...
You just need to set pins 12 and 13 for motor A and B direction, and PWM pins 3 and 11 for their speed.
Can You Provide Me With Sample Code I Tried It But Only One Motor Works.
adruinouno111:
Can You Provide Me With Sample Code I Tried It But Only One Motor Works.
Why don't you rather post your code so far and perhaps a pic of the circuitry.... then we can help you get it fixed, rather than do it for you 8)
int E1 = 3;
int M1 = 12;
int E2 = 11;
int M2 = 13;
void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}
void loop()
{
digitalWrite(M1,LOW);
digitalWrite(M2, LOW);
digitalWrite(E2, HIGH);
digitalWrite(E1, HIGH);
delay(5000);
}
It lights up both A and B lights but all i hear is humming?
Using 9V Battery Motors Are Each 3V
adruinouno111:
int E1 = 3;
int M1 = 12;
int E2 = 11;
int M2 = 13;void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}void loop()
{
digitalWrite(M1,LOW);
digitalWrite(M2, LOW);
digitalWrite(E2, HIGH);
digitalWrite(E1, HIGH);
delay(5000);
}
Please use the code quotes next time... Anyway I can directly see that you didn't define the pins of E1 and E2 as outputs.. Try this to begin with:
int E1 = 3;
int M1 = 12;
int E2 = 11;
int M2 = 13;
void setup()
{
pinMode(E1, OUTPUT);
pinMode(E2, OUTPUT);
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}
void loop()
{
digitalWrite(M1,LOW);
digitalWrite(M2, LOW);
digitalWrite(E2, HIGH);
digitalWrite(E1, HIGH);
delay(5000);
}
[SOLVED] I Had To Get A 4 AA Battery Pack For The Motor Shield.