Hi, I have a problem with my robotics project. I am building an autonomous car using a LiPo battery (2S) and a 15T motor and an Arduino board. I know that I have to initialize the ESC at the beginning of my code but for some reason, the initialization goes wrong sometimes. I don't know if my code is wrong or what. Sometimes the initialization is fine and I'm able to run the car, but sometimes it goes full reverse which is very inconvenient. These are the 8 lines of code I have to initiate the ESC:
throttle.attach(6);
throttle.write(70);
delay(2000);
digitalWrite(6,LOW);
delay(1000);
throttle.write(77);
delay(1000);
digitalWrite(6,LOW);