Hi folks, I need help please.
I building up table tennis robot with one feed servo and one main brushless motor with 30A ESC(both are managed by potentiometer). But I have problem. If I try control one or another motor, everything is great. But if I try to control both,only the servomotor chaotically works. There is my program and thank you for help..
#include <Servo.h>
Servo servo1; //feed servomotor
Servo motor1; // main brushless motor
int potpin1 = A0; // potenciometer for brushless motor
int potpin2 = A3; // potenciometer for feedservo
int val1 ; //brushless
int val2; // servomotor
void setup()
{
motor1.attach(9); // attaches the servo on pin 9 to the servo object
servo1.attach(3); //
}
void loop()
{
val2 = analogRead(potpin2);
val2 = map(val2, 0, 1023, 2000, 500);
servo1.write (10);
delay (500);
servo1.write (180);
delay(val2);
val1 = analogRead(potpin1);
val1 = map(val1, 0, 1023, 70, 170);
motor1.write(val1); // sets the servo position according to the scaled value
delay (1);
}
So the main brushless motor is for 11,1V and it is powered by 12V from computer ATX and goes through ESC. The servo motor is powered by 5V from ATX too. Now it is going well, but I have some problem when I connect both potentiometer to arduino. They are slow reacting and when the potentiometer(for servofeed) is on maximum, it doesnt give me delay 500 but i think that it is more than 1000.
There in the program:
val2 = map(val2, 0, 1023, 2000, 500);
servo1.write (10);
delay (500);
servo1.write (180);
delay(val2);
But if I dissconect one of the potentiometers, the servo works well with the program and on maximum it has 500milisec delay..
It doesnt matter even if I change code to 200. Arduino is no powered because there goes 5V from ESC. It is correct ?
Servo servo1; //feed servomotor
Servo motor1; // main brushless motor
or
Servo feeder;
Servo launch;
// No useless comments needed.
Arduino is no powered because there goes 5V from ESC. It is correct ?
It's not even comprehensible. The Arduino can NOT power a servo or an ESC. If that is what you are doing/expecting, the results you are seeing are perfectly understandable.
The both motors work now, but I have problem with the potentiometers ,that are slow reacting a the problem with control the feedservo. Please help me, thanks
Here is the picture