Hi Everyone,
Im trying to control an rc car using a motor shield. This RC car also has a camera mounted on top and is connected to a servo using pin 3. The strange part is, only one or the other work. When i use motordriver.h by itself it works correctly, when i add this to my existent code that includes the servo.h, the board lights up red but not blue and the motors will not move. I created two sketches that are exactly the same and even stranger, one sketch allows the servo to move (but no motors) and the other sketch allows the motors to move (but no servo). Sorry im not posting my code, i was just wondering if anyone else had similar problems with Servo.h and MotorDriver.h and found a way to resolve it. Thanks
Just pay attention to the pins used by Motor shield, many pins have been used by Motor shield, so you can’t use it tautologically.
I have the same problem using an IR Receiver on a mega2560. I have moved the IR pin around to avoid using pins 8-13. Every time I activate the IR Pin the motor shield stops, shield led’s turn red. Deactivate the IR pin, motors run fine.
I thought it was due to IR using Timer2 which is used by some of the motor shield pins. I
then used IR library that uses Timer5. Same issue. Seems like the Motor Shield does not like anything else playing with it, which makes it totally useless. Any help would be welcome.
Found the answer. I spent several hours working on programming for a servo and when it came time to run the motors, nothing. Thought I burned out the motor controller, so got another one, which was different. After carefully hooking it up and recoding, same issue.
Long story short, decided after much research to check the Arduino site. Guess what? When using Servo.h “use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.”
Since the Motor Shield uses pins 9 and 10, and analogWrite is disabled for those pins, the motors will not go.
So, what is the work around? Breadboards and lots of wires?
Timer2 which is used by some of the motor shield pins. I
then used IR library that uses Timer5. Same issue. Seems like the Motor Shield does not like anything else playing with it, which makes it totally useless. Any help would be welcome???