Hi!
I'm french, so I hope you will understand me ![]()
I've got this motor shield:
I want to make a robot, I plug my 4 dc motors to this shield, and I want to connect 1 servo to my arduino.
My servo is ok but my motors don't want to work! ![]()
#include <Servo.h>
// motor A
int dir1PinA = 13;
int dir2PinA = 12;
int speedPinA = 10;
// motor B
int dir1PinB = 11;
int dir2PinB = 8;
int speedPinB = 9;
//servo
Servo myservo; Â // create servo object to control a servo
void setup() {
Â
 //motor
 pinMode(dir1PinA, OUTPUT);
 pinMode(dir2PinA, OUTPUT);
 pinMode(speedPinA, OUTPUT);
 pinMode(dir1PinB, OUTPUT);
 pinMode(dir2PinB, OUTPUT);
 pinMode(speedPinB, OUTPUT);
Â
 myservo.attach(5);
}
void loop() {
analogWrite(speedPinA, 255);
analogWrite(speedPinB, 255);
digitalWrite(dir1PinA, HIGH);
digitalWrite(dir2PinA, LOW);
digitalWrite(dir1PinB, LOW);
digitalWrite(dir2PinB, HIGH);
myservo.write(90);
 delay(3000);
 myservo.write(0);
 delay(3000);
 myservo.write(180);
 delay(3000);
}
If I delete "myservo.attach(5)" , my dc motors works fine! (but not my servo)
How can I do all work?
thx ![]()