Advanced R&D Code

Advanced R&D Battery Testing

//accelerate all motors from 0 to 60% in 1 seconds

celerate(4,0,60,1);

//Run all motors for 7 seconds

goFor(7);

//Brake all motors

brake(4);

Servo Test

The following used servo (and worked successfully) 

//Go at 70% until reaches ~100 inches

motorSpeed(4,70);

goToRelativePosition(205);

//Go at 60% until ~40 inches

motorSpeed(4,60);

goToRelativePosition(82);

//Cut power to all motors and rotate servo 25 degrees to brake

brake(4);

rotateServo(25);

The following used power braking

//Go at 70% until reaches ~100 inches

motorSpeed(4,70);

goToRelativePosition(205);

//Go at 60% until ~33 inches

motorSpeed(4,60);

goToRelativePosition(68);

//Cut power to all motors and reverse

brake(4);

reverse(4);

//Reverse at 80% for 1 second

motorSpeed(4,80);

goFor(1);

The following is extension of servo code to go past gate after waiting

//Go at 70% until reaches ~100 inches

motorSpeed(4,70);

goToRelativePosition(205);

//Go at 60% until ~41 inches

motorSpeed(4,60);

goToRelativePosition(85);

//Cut power to all motors and rotate servo 25 degrees to brake

brake(4);

rotateServo(25);

//Wait 8 seconds and rotate back

brake(4);

goFor(8);

rotateServo(0);

//Go at 70% until reaches ~20 inches

motorSpeed(4,70);

goToRelativePosition(41);

//Cut power to all motors and rotate servo 25 degrees to brake

brake(4);

rotateServo(25);