Can someone help me with my coding. I doing my project for hand rehabilitation for stroke patient. By using EMG signal, 3 servo motor will rotate 100 degree. I only have coding for 1 servo motor.
Im using arduino Mega and servo motor MG995. Can somebody help. Im new in Arduino
const int threshValue = 250;
int value = analogRead(A3);
if(value < threshValue)
Hi Raycall and welcome to the forum.
When you post code, it helps us help you if you use code tags. Read up about it in the sticky post named "How to use this forum - please read"
Does the sketch you posted work the way you want?
And you simply want to add 2 more servos?
You *could* do that by connecting the 2 additional servos to the same pin 9 that the existing servo is connected to. And then provide power to the 2 new servos.
I hope that you are using an external power supply for the servos. The 5v pin on the arduino is insufficient for running multiple servos. In reality, it is insufficient for 1 servo but if it is a small servo, and unloaded, you can usually get away with it.
But you could also declare 2 additional servos, attach then to other pins, connect the 2 servos to those other pins and write to all 3 servos in your loop.
This would let you write unique values to each servo and is probably preferable.