programming Arduino uno with two esc's

hey. I’m working on a school project and I’m in having a lot of problems with the programming of the Arduino. my goal is to have two esc’s with the Arduino controlling two motors for a tank track. the escs I’m using are "Hobbywing quicrun"1060. I have no background in programing at all so I could really use a lot of help. so far I’m able to get the motors to go forward but not backwards. I found this program online and all the inputs I use get the motors to spin in one direction but not to brake or reverse. Please help!!!

#include <Servo.h>

Servo esc;

int escPin = 10;
int minPulseRate = 1000;
int maxPulseRate = 2000;
int throttleChangeDelay = 100;

void setup() {


// Attach the the servo to the correct pin and set the pulse range
esc.attach(escPin, minPulseRate, maxPulseRate);
// Write a minimum value (most ESCs require this correct startup)


void loop() {

// Wait for some input
if (Serial.available() > 0) {

// Read the new throttle value
int throttle = normalizeThrottle( Serial.parseInt() );

// Print it out
Serial.print("Setting throttle to: ");

// Change throttle to the new value



void changeThrottle(int throttle) {

// Read the current throttle value
int currentThrottle = readThrottle();

// Are we going up or down?
int step = 1;
if( throttle < currentThrottle )
step = -1;

// Slowly move to the new throttle value
while( currentThrottle != throttle ) {
esc.write(currentThrottle + step);
currentThrottle = readThrottle();


int readThrottle() {
int throttle =;

Serial.print("Current throttle is: ");

return throttle;

// Ensure the throttle value is between 0 - 180
int normalizeThrottle(int value) {
if( value < 0 )
return 0;
if( value > 180 )
return 180;
return value;

what I do know is that with programing an esc you use angles for speeds. the problem is when is input 0~50 I’m not getting any movement in the motor, then from ~51 to 180 the motor increases speed in one direction.

But what is the output of the serial when you input40?

Because, except from the blocking nature of delay() and Serial.parseInt(), and the abuse of making everything int, I don't see anything weird.

And a small problem wit is it may not return the same angle was you wrote. This is because it converts it to the number of tick it needs and back again when you do a .read(). But probably not an issue here.

Those ESCs work in either forward only or forward/reverse mode. It sounds like yours is in forward only. You need to program it for the other mode.


Those ESCs work in either forward only or forward/reverse mode. It sounds like yours is in forward only. You need to program it for the other mode.

If you look at the manual here:-

You'll find it's a little more complicated than that. The ESC has three operating modes Forward/Brake/Reverse, Forward/Brake and Forward/Reverse. The default setting is Forward/Brake/Reverse. This requires what the manufactures call a "double click" action to go from forward to reverse. For this the throttle is taken to reverse and the motor starts to slow down, then throttle is taken back to the neutral position and once the motor stops it can then be driven into reverse.

For testing and use in a tracked vehicle the OP should probably switch the ESC into the Forward/Reverse mode (this means changing the links on the unit).


thanks for the help. It was the problem with the ESC that I had to fix to make the program work. I appreciate all the help