Running brushed ESC with arduino

I wouldn't call it exactly simple but first let's see if I've understood your requirement.

If the last write to the servo was >1500 (forward) and the new value you want to write is <=1500 (reverse)

  • before writing that value you need to initialise reverse mode
  • to do that you write a value < 1400 pause write exactly 1500 and pause again
    (if you've been doing it manually you won't know how long the pauses need to be so try 1/2 second)
  • then you can write the reverse value <= 1500 that you wanted to originally.

Presumably once you've gone through the 'initialise reverse mode' rigmarole you can carry on sending various values <=1500 as you wish?

Are you sure there is no problem going from reverse (<=1500) back to forward again? That's at least as bad for the ESC/motor as going from forward to reverse.

If that's right you will need to remember the last thing you wrote to the motor. Pseudocode might be something like:
// I don't like using the same variable for different things so the output of your map shouldn't be potValue
// I've called it writeValue

if lastWrite > 1500 and writeValue <=1500
{
initReverse()
}
then write (writeValue)
set lastWrite = writeValue

// function definition
initReverse()
{
write(1000)
delay(500)
write(1500)
delay(500)
}

Or something like that.

Good luck - Steve