anyone/tom carpenter- thanks for the reply.
1-let me this right. D12+D3 are wired together when using screwblock A. D13+D11 are wired together when using screwblock B. but all four stand alone when pining into them individually and then do the same thing. am i correct in this?
2-here is my sketch
int motor = 12;
int pwm = 3;
void setup()
{
pinMode(motor,OUTPUT);
pinMode(pwm,OUTPUT);
}
void loop()
{
digitalWrite(motor,HIGH);
analogWrite(pwm,255);
delay(1000);
digitalWrite(motor,LOW);
analogWrite(pwm,255);
delay(1000);
}
when i run this same sketch but substitute D12 for D13 and D3 for D11 the motor just continuously drives in one direction. i have switched motors and get the same result. is there a short in my board or did i mess up my sketch again? here is the sketch crossroads wrote for me(thanks you!)
//give the pins a name for easy reading (nothing wrong with the way you had it, its just harder to read DirA = 12;
int DirA = 12;
int DirB = 13;
int PWMA = 3;
int PWMB = 11;
void setup()
{
pinMode(DirA ,OUTPUT); //Set them all to outputs.
pinMode(DirB ,OUTPUT);
pinMode(PWMA ,OUTPUT);
pinMode(PWMB ,OUTPUT);
}
void loop()
{
//forward
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500)
//turn right
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,0); //right motor stopped
analogWrite(PWMB ,255); //left at full speed
delay(500);
//forward
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500);
//turn left
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,HIGH); //both to forward
analogWrite(PWMA ,255); //right to full speed
analogWrite(PWMB ,0); //left motor stopped
delay(500);
//reverse
;digitalWrite(DirA ,LOW);
digitalWrite(DirB ,LOW); //both to reverse
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500);
//180 degree turn
;digitalWrite(DirA ,HIGH);
digitalWrite(DirB ,LOW); //opposite directions to spin on the spot
analogWrite(PWMA ,255);
analogWrite(PWMB ,255); //both at full speed
delay(500);
}
//end
i know this sketch is good cause it was written by a pro, but i get the same result with either D13 or D11 not functioning correctly and switching in a new motor to check. any ideas?
thanksall
-ed