Arduino Code

Getting Familiar with Arduino and Sketchbook

celerate(1,0,15,2.5); Accelerate motor one from start to 15% power in 2.5 seconds.jk

goFor(1); Run motor one at a constant speed (15% power) for 1 second.

brake(1); Brake motor one.

celerate(2,0,27,4); Accelerate motor two from start to 27% power in 4 seconds.

goFor(2.7); Run motor two at a constant speed (27% power) for 2.7 seconds.

celerate(2,27,15,1); Decelerate motor two to 15% power in 1 second.

brake(2); Brake motor two.

reverse(2); Reverse the direction of only motor 2.

celerate(4,0,31,2); Accelerate all motors from start to 31% power in 2 seconds.

motorSpeed(4,35); goFor(1);Run all motors at a constant speed of 35% power for 1 second.

brake(2); motorSpeed(1,35); goFor(3); Brake motor two but keep motor one running at a constant speed (35% power) for 3 seconds.

brake(4); goFor(1); Brake all motors for 1 second.

reverse(1); Reverse the direction of motor one.

celerate(1,0,19,2); Accelerate motor one from start to 19% power over 2 seconds.

motorSpeed(2,35); motorSpeed(1,19); goFor(2); Run motor two at 35% power while simultaneously running motor one at 19% power for 2 seconds.

motorSpeed(4,19); goFor(2); Run both motors at a constant speed (19% power) for 2 seconds.

celerate(4,19,0,3); Decelerate both motors to 0% power in 3 seconds.

brake(4); Brake all motors.

 

Code Used to Test Reflectance Sensors:

celerate(4,0,25,2); Run all motors at a constant speed of 25% power for 2 seconds.

motorSpeed(4,20); goToAbsoultePosition(25); Run all motors at a constant speed of 20% and using the goToAbsolutePosition function travel a total distance of 12 feet (from the starting point).

reverse(4); Reverse motors.

motorSpeed(4,30); goFor(1.5); Run all motors at a constant speed of 30% power for 1.5 second.

brake(4); Brake all motors.

 

Testing DataExtraction tool code

celerate(4,0,25,3); Accelerate all motors from start to 25% in 3 seconds.

goFor(1); Run all motors at a constant speed (25% power) for 1 second.

motorSpeed(4,20); goFor(2); Run all motors at 20% power for 2 seconds.

reverse(4); Reverse all motors.

motorSpeed(4,25); goFor(2); Run all motors at a constant speed (25% power) for 2 second.

brake(4); Brake all motors.

 

Motor configuration test code

Motor Configuration

  • Forward test

Celerate(4,0,20,1); //Run all motors at 20% Power

goFor(5); //Runs for 5 seconds

brake(4); //Stops motors and AEV

  • Reverse test

reverse(4); //reverse the motors

Celerate(4,0,20,1); //Run all motors at 20% Power

goFor(5); //Runs for 5 seconds

brake(4); //Stops motors and AEV

 

Servo Calibration & Use

  • CODE USED FOR EXPERIMENT

celerate(4,0,40,3); // Accelerates all motors from 0 to 40% in 3 seconds

goFor(2); // Maintains speed for 2 seconds.

brake(4); // Stops all motors.

rotateServo(90); // Rotates servo arm 90 degrees.

  • CODE USED FOR CONTROL

celerate(4,0,40,3); // Accelerates all motors from 0 to 40% in 3 seconds

goFor(2); // Maintains speed for 2 seconds.

brake(4); // Stops all motors.

 

Performance Tests

Code for Performance Test one:

celerate(4,0,35,1); //Accelerates all motors from 0 to 35% power in 1 second.

goFor(3.75); //Maintains speed for 3.75 seconds.

brake(4); //Stops all motors.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,50,2.5); //Accelerates all motors from 0 to 50% power in 2.5 seconds.

brake(4); //Stops all motors.

goFor(7); //Maintains speed for 7 seconds.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,40,8); //Accelerates all motors from 0 to 40% power in 8 seconds.

brake(4); //Stops all motors.

 

Code for Performance test two:

Celerate(4,0,30,1); //Accelerates all motors from 0 to 30% power in 1 second.

goFor(4.3); //Maintains speed for 4.3 seconds.

Brake(4); //Stops all motors.

Reverse(4); //Reverses the polarity of the motors.

Celerate(4,0,50,2.5); //Accelerates all motors from 0 to 50% power in 2.5 seconds.

Brake(4); //Stops all motors.

goFor(9); //Maintains speed for 9 seconds.

Reverse(4); //Reverses the polarity of the motors.

motorSpeed(4,30); //Maintains speed at 30% power.

goFor(3); //Maintains speed for 3 seconds.

Brake(4); //Stops all motors.

Reverse(4); //Reverses the polarity of the motors.

motorSpeed(4,30); //Maintains speed at 30% power.

goFor(2.38); //Maintains speed for 2.38 seconds.

Brake(4); //Stops all motors.

Celerate(4,0,35,2); //Accelerates all motors from 0 to 35% power in 2 seconds.

Brake(4); //Stops all motors.

goFor(7); //Maintains speed for 7 seconds.

motorSpeed(4,40); //Maintains speed at 40% power.

goFor(3.3); //Maintains speed for 3.3 seconds.

brake(4); //Stops all motors.

 

Final Performance Test

celerate(4,0,30.1); //Accelerates all motors from 0 to 30% power in 1 second.

goToAbsolutePosition(-215); //Continues the previous command for -215 marks relative to the overall starting position of the AEV

brake(4); //Stops all motors.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,40,1); //Accelerates all motors from 0 to 40% power in 1 second.

goFor(1); //Maintains speed for 1 second.

brake(4); //Stops all motors.

goFor(8.5); //Maintains speed for 8.5 seconds.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,30,1); //Accelerates all motors from 0 to 30% power in 1 second.

goToRelativePosition(-119); //Continues the previous command for -119 marks from the vehicle’s current position.

brake(4); //Stops all motors.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,24,1); //Accelerates all motors from 0 to 24% power in 1 second.

goFor(2.7); //Maintains speed for 2.7 seconds.

brake(4); //Stops all motors.

goFor(4.5); //Maintains speed for 4.5 seconds.

celerate(4,0,58,1) //Accelerates all motors from 0 to 58% power in 1 second.

goToRelativePosition(178); //Continues the previous command for 178 marks from the vehicle’s current position.

brake(4); //Stops all motors.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,33.5,2); //Accelerates all motors from 0 to 33.5% power in 2 seconds.

goFor(1); //Maintains speed for 1 second.

brake(4); //Stops all motors.

goFor(7); //Maintains speed for 7 seconds.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,50,1); //Accelerates all motors from 0 to 50% power in 1 second.

goToRelativePosition(160); //Continues the previous command for 160 marks from the vehicle’s current position.

brake(4); //Stops all motors.

reverse(4); //Reverses the polarity of the motors.

celerate(4,0,39,1); //Accelerates all motors from 0 to 39% power in 1 second.

goFor(2.3); //Maintains speed for 2.3 seconds.

brake(4); //Stops all motors.