ESC Not Arming Because Not Reading Zero Throttle

Hello,
I am trying to arm my ESC (listed at the bottom), it is supposed arm like the photo shown but I cannot get the last "beep" which means it is not seeing zero throttle. But it is getting the throttle for the 4th beep, anyone see anything wrong with my code that could be causing this?

#include<Servo.h>

#define RCPin 2
#define OutPin 5
int RCValue, i, ch; 
Servo ESC;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(RCPin, INPUT);
  pinMode(OutPin, OUTPUT);
  //ESC.attach(OutPin,1000,2000);
  digitalWrite(OutPin, HIGH);
  delayMicroseconds(1000);
  digitalWrite(OutPin, LOW);
  delayMicroseconds(1500);
  delay(500);
  
}

void loop() {
  // put your main code here, to run repeatedly:
  //RCValue = pulseIn(RCPin, HIGH);
  //ch = map(RCValue, 1000, 2000, 100, 0);
  //Serial.println(ch);
  for (i=0; i<=100; i++) {
    digitalWrite(OutPin, HIGH);
    delayMicroseconds(1200);
    digitalWrite(OutPin, LOW);
    delayMicroseconds(1300);
  }
  for (i=0; i<=100; i++) {
    digitalWrite(OutPin, HIGH);
    delayMicroseconds(800);
    digitalWrite(OutPin, LOW);
    delayMicroseconds(1700);
  }
  exit(0);
  
  //ESC.write(1000);
}

Servo - hitec hs-645mg
https://hitecrcd.com/products/servos.../hs-81/product

Arduino Mega
https://store-usa.arduino.cc/collect...eac57cb3&_ss=c

Esc -Lumenier Elite 60A 2-6S BLHeli_32 4-in-1 ESC

https://www.getfpv.com/lumenier-elit...-in-1-esc.html

Lipo 4s battery- 1300mAh 4S Lipo Battery 14.8V 100C
https://www.amazon.com/CNHL-1300mAh-...st_sto_dp&th=1

Receiver for flysky fs-iA10B

Why aren't you using the Servo library to control the ESC ?

Note that the loop() function will run continuously even with the exit(0); there. where do you imagine the loop() function exits to ?

If you want code to run once then put it in the setup() function

Even then, the low servo signal must be low enough.
Some esc may require low-high-low to arm.

What do you suggest I try to change?

I read on these fora that exit(0); does

cli(); //disable interrupts
while(1); //forever loop

It would be better to have the sequence play out once per button press.

And it would be easier to use the library function.

And

[quote="lipo_guard, post:1, topic:1212913"]
`  for (i=0; i<=100; i++) {`
[/quote]

are these long enough to be recognized by the test in the ESC?

a7

@alto Thanks for the correction, but I must say that I am surprised at that discovery

Here is what the IDE has to say about it

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.