i want to connect 8 servo to mega2560 and control them with potentiometer (one potentiometer for control 2 servo)
when i connect one servo there is no problem and it works well but when i connect the second servo, second servo start to shake and doesn’t work
here is the code:
int potpin = 0;
val = analogRead(potpin);
val = map(val, 0, 1023, 0, 179);
val2 = analogRead(potpin);
val2 = map(val2, 0, 1023, 179, 0);
thanks for your answers
I don't use arduino for servo power
i use a 2amp power supply and there are7 servos
you mean i use another power supply ?(with capability of more than 2amp)
what do you mean by lack of decoupling?
thanks for the links.they are very useful
i don't use decoupling in my project and i will use it
in then first link i saw he used 2 separate power supply for arduino and servo.in this case we must connect gnd of 2 power supply to each other.am i right?
in my circuit i connect the usb to laptop and connect the servos to the power supply,it mean i use 2 separate power supply,is it right?
in this case i think if i use decoupling it may get better