Arming a brushless motor through ESC - 3

This is a continuation of:

Arming a brushless motor through ESC - Using Arduino / Project Guidance - Arduino Forum

Arming a brushless motor through ESC - 2 - Using Arduino / Project Guidance - Arduino Forum

Made some progress arming the controller and making the motor work with the code below.

I am having to turn on the ESC, wait for a while and then reset Arduino every time to arm it.

  • I am fine arming it every time. But Why am I having to reset the board every time? Any one, any thoughts, alternatives, solutions?

  • At times, Arduino resets itself and arms again then spins. Reliability issue?

#include <Servo.h>
Servo motor;

void setup ()
{
motor.attach(2); //ESP8266 PIN 9 - GPIO2
Serial.begin(9600);
int i = 0;

//turn on ESC and then reset Arduino board
delay(10000);

// Watch for 3 beeps when the ESC gets armed
for(i = 60; i < 80; i++)
{
Serial.println(i);
motor.write(i);
delay(500);
}

delay(1000);

// Watch for one beep when the ESC gets fully armed
for(i = 60; i < 80; i++)
{
Serial.println(i);
motor.write(i);
delay(500);
}
}

void loop()
{

motor.write(84); delay(10000); //spins for 10s
motor.write(70); delay(5000); //stops for 5s

}