Hello! I'm building the MeArm detailed here:
I have the breadboard in that exact way.
My code is as follows:
/*
Adafruit Arduino - Lesson 14. Sweep
*/
#include <Servo.h>
int basePin = 7;
int leftPin = 10;
int rightPin = 9;
int clawPin = 8;
Servo base_servo;
Servo left_servo;
Servo right_servo;
Servo claw_servo;
int angle = 0; // servo position in degrees
void setup()
{
base_servo.attach(basePin);
//left_servo.attach(leftPin);
}
void loop()
{
// scan from 0 to 180 degrees
for(angle = 0; angle < 180; angle++)
{
base_servo.write(angle);
delay(15);
}
// now scan back from 180 to 0 degrees
for(angle = 180; angle > 0; angle--)
{
base_servo.write(angle);
delay(15);
}
}
As you can see, in my code I have "left_servo.attach(leftPin)" commented out.
With that line commented out, my MeArm rotates 180 degrees back and forth, as expected. Yay!
However, when I uncomment that line and left_servo.attach() is run, my MeArm glitches out. Sometimes not rotating at all, sometimes doing a few jerky rotations, sometimes moving the arm randomly.
This seems to be some kind of power breakdown or something, from my understanding? But I see several other people have several servos running off less power.
I am powering my arduino with a USB and I am powering the servos (through the breadboard) with a 9V battery. My servos say they need 3-7 volts. I am using these servos: https://www.amazon.co.uk/dp/B06XNN1P5Z/ref=pe_3187911_189395841_TE_3p_dp_1
I tried some googling but didn't find any clear solutions.
Should I just be wiring a bunch more batteries to the servos?