hello guys!! I am new here I was trying to arm my esc using arduino but I didn't find a solution!! I am using this code but sometimes they spin and sometimes they keep beeping!! and sometimes they spin when I open the serial monitor!!!
int escPin1 = 8;
int escPin2 = 9;
int escPin3 = 10;
int escPin4 = 11;
int escPin5 = 12;
int escPin6 = 13;
int arm = 1100; // pulse width in microseconds for arming
int speedvalue = 1450; // pulse width in microseconds for operation
void setup()
{
// It appears that the ESC will accept a range of values for the arming
// sequence. This provides 10 pulses with a pulse width of 1000 us with
// with a 20 ms delay between pulses.
pinMode(escPin1, OUTPUT);
for (int count = 0; count < 10; count++){
digitalWrite(escPin1, HIGH);
delayMicroseconds(arm);
digitalWrite(escPin1, LOW);
delay(20);
digitalWrite(escPin2, HIGH);
delayMicroseconds(arm);
digitalWrite(escPin2, LOW);
delay(20);
digitalWrite(escPin3, HIGH);
delayMicroseconds(arm);
digitalWrite(escPin3, LOW);
delay(20);
digitalWrite(escPin4, HIGH);
delayMicroseconds(arm);
digitalWrite(escPin4, LOW);
delay(20);
digitalWrite(escPin5, HIGH);
delayMicroseconds(arm);
digitalWrite(escPin5, LOW);
delay(20);
digitalWrite(escPin6, HIGH);
delayMicroseconds(arm);
digitalWrite(escPin6, LOW);
delay(20);
}
}
void loop()
{
// Once armed the ESC needs to receive a pulse train to operate the
// the motor. The motor speed is controlled by the duration of the
// pulse width.
// This simple loop provides a pulses width a width of 1450 us and a
// separation of 20 ms.
digitalWrite(escPin1, HIGH);
delayMicroseconds(speedvalue);
digitalWrite(escPin1, LOW);
delay(20);
digitalWrite(escPin2, HIGH);
delayMicroseconds(speedvalue);
digitalWrite(escPin2, LOW);
delay(20);
digitalWrite(escPin3, HIGH);
delayMicroseconds(speedvalue);
digitalWrite(escPin3, LOW);
delay(20);
digitalWrite(escPin4, HIGH);
delayMicroseconds(speedvalue);
digitalWrite(escPin4, LOW);
delay(20);
digitalWrite(escPin5, HIGH);
delayMicroseconds(speedvalue);
digitalWrite(escPin5, LOW);
delay(20);
digitalWrite(escPin6, HIGH);
delayMicroseconds(speedvalue);
digitalWrite(escPin6, LOW);
delay(20);
}
any help is really appreciated!! also, using the servo library keeps the motors beep all the time!! what should I do and how should I arm??
Replies