I have 1 servo working. The code works fine when I am only using 1 servo. My problem is I want to control 4 servos at once, but only 1 servo will respond. I think the problem is my arduino will only write to ONE of the FOUR pins. Here is my code. All servos have been checked separately and work. Each pin/port works by itself. Furthermore, When I have 2 pins connected only 1 will work.
They are connected directly to a 12v source of AA batteries. I thought it was possible the power source was too weak to handle more than 1 servo running simultaneously, so I tested that theory. I used only 1 pin from the arduino and used a breadboard to connect TWO servos to that single pin. Both servos worked correctly.
So in other words, if I just wanted to connect all 4 servos to 1 port on the arduino, it would work fine. The problem with that is I obviously want to be able to control the servos independently. I'm starting to think my arduino is defective in some way, or I am missing something.
You are correct. These are actually ESCs connected to brushless motors. I didn't mention it because I am having this exact pin problem with a few other beginner projects I have been working on. For example: I was using a transmitter and trying to write a HIGH signal to multiple pins, and it would only write to 1 pin instead of 4. I have tried different pins. I have tried spacing out my connections on the board (ex pin 1, 4, 7,9....) but that didn't help.
jakefeb3:
You are correct. These are actually ESCs connected to brushless motors.
Powering 4 ESCs from a stack of AA cells? That's really pushing your luck. Expect
peak current flows in the 10 to 40A range on starting all 4 simultaneously, LiPo batteries
are practically a necessity for these motors, they have winding resistances measured in
fractions of an ohm.
Trust us, Arduinos can drive 4 pins simultaneously from the Servo library, there is
some problem somewhere, a process of detection is needed to narrow down what's
happening - it doesn't help to hide pertinent facts (calling a BLDC+ESC a servo...), all
details could be relevant.
I have found the problem and solution. I just bought an official arduino uno board manufactured by arduino. The arduino that was causing the problems was a generic brand called OSEPP uno. I bought that brand out of Frys electronics thinking it was equivalent to an official arduino board. It is obviously not. The lesson learned is only buy official arduino boards.
My code works now and I can continue with my project. The AA batteries are just a temporary power source for testing purposes.