Hello all,
Fisrt of all I am new on this forum and website so...
I was googling this problem but I didn't find anything about this problem ..
I have 4 motors connected on pins: 6, 7, 8, 9
- ATmega2560
- 2300kv brushless
- 12A ESCs
- Turnigy 5000 mAh
Motors on pins 6, 8 doesn't work OK, you will see:
I upload my video that shows the problem with my project:
and here is my arduino code (for testing servos):
#include <LiquidCrystal.h> //Display
#include <Servo.h> //the servo library
Servo motor_1, motor_2, motor_3, motor_4; //servos
LiquidCrystal lcd(37, 39, 2, 3, 4, 5); //lcd pins
int pos = 90, brithness = 0;
void setup() {
lcd.begin(16, 2);
lcd.print("Loading...");
Serial.begin(9600);
motor_1.attach (6); //bad servo
motor_2.attach (7);
motor_3.attach (8); //bad servo
motor_4.attach (9);
delay(200);
pinMode(22, OUTPUT);
pinMode(50, OUTPUT);
pinMode(51, OUTPUT);
pinMode(52, OUTPUT);
pinMode(53, OUTPUT);
digitalWrite(22, LOW);
digitalWrite(50, LOW);
digitalWrite(51, LOW);
digitalWrite(52, LOW);
digitalWrite(53, LOW);
motor_1.write(90);
motor_2.write(90);
motor_3.write(90);
motor_4.write(90);
lcd.clear();
lcd.print("Ready");
}
void loop() {
delay(3000);
lcd.clear();
lcd.print("testing motor 1");
for(pos = 0; pos < 125; pos += 1) // goes from 0 degrees to 125 degrees
{ // in steps of 1 degree
motor_1.write(pos); // tell servo to go to position in variable 'pos'
delay(30);
}
for(pos = 125; pos>=40; pos-=1) // goes from 125 degrees to 0 degrees
{
motor_1.write(pos); // tell servo to go to position in variable 'pos'
delay(30);
}
delay(3000);
lcd.clear();
lcd.print("testing motor 2");
for(pos = 0; pos < 125; pos += 1) // goes from 0 degrees to 125 degrees
{ // in steps of 1 degree
motor_2.write(pos); // tell servo to go to position in variable 'pos'
delay(30); // waits 15ms for the servo to reach the position
}
for(pos = 125; pos>=40; pos-=1) // goes from 125 degrees to 0 degrees
{
motor_2.write(pos); // tell servo to go to position in variable 'pos'
delay(30);
}
delay(3000);
lcd.clear();
lcd.print("testing motor 3");
for(pos = 0; pos < 125; pos += 1) // goes from 0 degrees to 125 degrees
{ // in steps of 1 degree
motor_3.write(pos); // tell servo to go to position in variable 'pos'
delay(30);
}
for(pos = 125; pos>=40; pos-=1) // goes from 125 degrees to 0 degrees
{
motor_3.write(pos); // tell servo to go to position in variable 'pos'
delay(30);
}
delay(3000);
lcd.clear();
lcd.print("testing motor 4");
for(pos = 0; pos < 125; pos += 1) // goes from 0 degrees to 125 degrees
{ // in steps of 1 degree
motor_4.write(pos); // tell servo to go to position in variable 'pos'
delay(30);
}
for(pos = 125; pos>=40; pos-=1) // goes from 125 degrees to 0 degrees
{
motor_4.write(pos); // tell servo to go to position in variable 'pos'
delay(30);
}
lcd.print("stopped");
delay(5000);
for(pos = 0; pos < 125; pos += 1) // goes from 0 degrees to 125 degrees
{
motor_1.write(pos);
motor_2.write(pos);
motor_3.write(pos);
motor_4.write(pos); // tell servo to go to position in variable 'pos'
delay(50);
}
for(pos = 125; pos>=0; pos-=1) // goes from 125 degrees to 0 degrees
{
motor_1.write(pos);
motor_2.write(pos);
motor_3.write(pos);
motor_4.write(pos);
delay(50);
}
lcd.print("stopped");
delay(5000);
}
Thanks for all help and I hope that is not problem with my motors.. :~