The code I'm using is written by Nick (njs552) so far I have only made a small mod to the pan and tilt stuff but now that I've had a few dives I want to do much more but will consult with Nick to see if he wants to do the same.
At the moment Nick's code has 3 gears
I don't have the LCD setup yet but won't be viewing it with my final setup anyways, ideally a On Screen Display of the gear would be great.//Gear Speed Select
if(ps2x.ButtonPressed(PSB_SELECT) && motorSpeed < 3) //select motor speed
{
motorSpeed++;
data.motorSpeed++;
lcd.setCursor(0, 2);
lcd.print(motorSpeed);
}
else if(ps2x.ButtonPressed(PSB_SELECT) && motorSpeed == 3) //select motor speed
{
motorSpeed = 1;
data.motorSpeed = 1;
}
lcd.setCursor(0, 2);
lcd.print(motorSpeed);
Also using the setup button is clumsy, I'm going to try to code the R1 and R2 buttons to be up and down and have a gear range of say 6-10 gears. It sounds excessive but in the water, I was crashing into things all over the place (poor visibility)
Currently R1 is for dive (verticals down) but I will change that to L2, more intuitive I think.
@A_shorething below is the code (written by NIck) that limits the current now, in my case the current is limited to 10amps @ 12v, wide open throttle draws 24amps.
The verticals have not been mapped, with the ROV sitting on the bottom at 4m it still makes the water boil at the surface(so to speak) If I have the trusters pushing down.{
LSYVal = map(LSYVal, 0, 255, 60, 185); //limit current draw to 2A @ 12v
data.motor1 = LSYVal;
RSYVal = map(RSYVal, 0, 255, 60, 185); //limit current draw to 2A @ 12v
data.motor2 = RSYVal;
}