I have connected my servomotor (MG996R) to my L293D motor shield, which is connected to an Arduino Uno R3 Board.
I use 4x AA 1.2V NiMH batteries to power the shield, and a regular 9V battery to power the Arduino separately. I've removed the jumper wire on the shield.
I've tried uploading all the example codes I could find, multiple times, yet none of them work. The servomotor simply doesn't move at all.
Is there anyway I could see if my servomotor is broken ? Maybe the wiring is wrong, but I don't think so. Orange is for signal, Red is for + and Brown is for GND.
Could someone help troubleshoot the problem ? Thanks !
PS : here is the example code I use
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
<Servo.h>
? Your code is intended to work with servos attached directly to Arduino. It will not work with servos attached to some external shield. Your shield is supposed to have its own library/protocol for controlling stuff attached to it.