Testing Arduino Codes – Testing Logs

Introductory Code

Energy Recorded: N/A

 

void myCode()

{

// Program between here——————————————————————-

//Accelerates motor one from start to 10% power in 3 seconds.

celerate(1,0,10,3);

//Runs motor one at a constant speed (10% power) for 1 second.

motorSpeed(1,10);

goFor(1);

//Brakes motor one.

brake(1);

//Accelerates motor two from start to 27% power in 4 seconds.

celerate(2,0,27,4);

//Runs motor two at a constant speed (27% power) for 3 seconds.

motorSpeed(1,27);

goFor(3);

//Decelerates motor two to 20% power in 1 second.

celerate(2,27,20,1);

//Brakes motor two.

brake(2);

//Reverses the direction of only motor 2.

reverse(2);

//Accelerates all motors from start to 34% power in 4 seconds.

celerate(4,0,34,4);

//Runs all motors at a constant speed of 30% power for 2 seconds.

motorSpeed(4,30);

goFor(2);

//Brakes motor two but keeps motor one running at a constant speed (30% power) for 3 seconds.

brake(2);

motorSpeed(1,30);

goFor(3);

//Brakes all motors for 1 second.

brake(4);

goFor(1);

//Reverses the direction of motor one.

reverse(1);

//Accelerates motor one from start to 15% power over 2 seconds.

celerate(1,0,15,2);

//Runs motor two at 21% power while simultaneously running motor one at 15% power for 2 seconds.

motorSpeed(2,21);

goFor(2);

motorSpeed(1,15);

goFor(2);

//Runs both motors at a constant speed (21% power) for 2 seconds.

motorSpeed(4,21);

goFor(2);

//Reverses motor one.

reverse(1);

//Runs both motors at their last constant speed for an additional 2 seconds

motorSpeed(4,21);

goFor(2);

//Decelerates both motors to 0% power in 5 seconds.

celerate(4,21,0,5);

//Brakes all motors.

brake(4);

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()

 

Reflective Sensors Introductory Code:

Energy Recorded:  N/A

 

External Sensors Code

void myCode()

{

//—————————————————————————————-

// myCode();

reverse(4); // Reverses all motors so that they propel the AEV forward

motorSpeed(4,25); // Sets all motors to 25 % power

goFor(2); // Keeps the motors running at 25% power for two seconds

motorSpeed(4,20); // Sets all motors to 20% power

goToAbsolutePosition(394); // the AEV travels until an absolute distance of 16 feet at 20% power

reverse(4); // Reverses all motors

motorSpeed(4,30); // Runs all motors at 30% power output

goFor(1.5); // Repeats the previous command for two seconds
brake(4);​ // Brakes all motors

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()

 

Energy Analysis 1 Code 

Energy Recorded: 39.37 J

 

void myCode()

{

reverse(1); // Reverses the motor for correct orientation

motorSpeed(4,0); // Makes all motors go at 0% power

goFor(1); //Repeats the command for 1 second

celerate(4,0,30,2); // Accelerates all motors from 0% to 30% power over 2 seconds

motorSpeed(4,30); // Makes the motors run a 30% power

goFor(2); // Repeats the last command for two seconds

reverse(4); // Reverses all motors

motorSpeed(4,40); //Makes all motors run at 40% power

goFor(1); // Repeats the last command for 1 second

brake(4); // Brakes all motors

goFor(1); // Repeats last command for 1 second

reverse(4); // Reverses all motors

motorSpeed(4,20); // Runs all motors at 40% power

goFor(1); // Repeats last command for 1 second

brake(4); // Brakes all motors

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()

 

System Analysis 2 Code

Energy Recorded: 94.34 J

 

void myCode()

{

reverse(1); // reverses the spin of the motor 1

celerate(4,0,20,2); // accelerates all motors from 0% to 20% power in 2 seconds

goToAbsolutePosition(246); // runs all motors at a constant speed (at 20% power) for 246 marks (10 feet)

brake(4); // brakes all motors

goFor(1); // runs the brake command for 1 second

celerate(4,0,30,2); // accelerates all motors from start to 30% power in 2 seconds

motorSpeed(4,20); // runs all motors at a constant speed (20% power)

goToAbsolutePosition(467); // runs the last command until it reaches 467 marks (19 feet)

reverse(4); // reverses all motors

motorSpeed(4,30); // runs all motors at a constant speed (30% power)

goFor(1.5); // runs the preceding motorSpeed command for 1.5 seconds

// And here——————————————————————————–

}

// DO NOT REMOVE. end of void myCode()

 

Performance Test 1 Code

Energy Recorded for Design 1: 80.05 J

Energy Recorded for Design 2: 89.79 J

 

void myCode()

{

reverse(1); // reverses the spin of the motor 1

celerate(4,0,20,2); // accelerates all motors from 0% to 20% power in 2 seconds

goToAbsolutePosition(246); // runs all motors at a constant speed (at 20% power) for 246 marks (10 feet)

brake(4); // brakes all motors

goFor(1); // runs the brake command for 1 second

celerate(4,0,30,2); // accelerates all motors from start to 30% power in 2 seconds

motorSpeed(4,20); // runs all motors at a constant speed (20% power)

goToAbsolutePosition(467); // runs the last command until it reaches 467 marks (19 feet)

reverse(4); // reverses all motors

motorSpeed(4,30); // runs all motors at a constant speed (30% power)

goFor(1.5); // runs the preceding motorSpeed command for 1.5 seconds

// And here——————————————————————————–

}

// DO NOT REMOVE. end of void myCode()

 

Performance Test 2 Code

Energy Recorded: 243 J

 

void myCode()

{

reverse(1); // reverses the spin of the motor 1

celerate(4,0,23,2); // accelerates all motors from 0% to 23% power in 2 seconds

goToAbsolutePosition(243); // runs all motors at a constant speed (at 23% power) for 243 marks

brake(4); // brakes all motors

goFor(1); // runs the brake command for 1 second

celerate(4,0,25,2); // accelerates all motors from start to 25% power in 2 seconds

motorSpeed(4,22); // runs all motors at a constant speed (22% power)

goToAbsolutePosition(410); // runs the last command until it reaches 410 marks

brake(4); // brake all motors

goFor(10); // runs the brake command for 7 seconds

celerate(4,0,23,2); // accelerates all motors from 0% to 23% power in 2 seconds

motorSpeed(4,23); // runs all motors at a constant speed (23% power)

goToAbsolutePosition(810); // runs the last command until it reaches 810 marks

brake(4); // brakes all motors

goFor(12); // runs the brake command for 12 seconds

reverse(4); // reverses all motors

celerate(4,0,40,2); // accelerates all motors from 0% to 40% power in 2 seconds

motorSpeed(4,30); // runs all motors at a constant speed (30% power)

goToAbsolutePosition(725); // runs the last command until it reaches an absolute position of 725 marks

brake(4); // brakes all motors

goFor(12); // runs the brake command for 12 seconds

celerate(4,0,30,2); // accelerates all motors from start to 30% power in 2 seconds

motorSpeed(4,30); // runs all motors at a constant speed (30% power)

goToAbsolutePosition(190); // runs the last command until it reaches an absolute position 190 marks

// And here——————————————————————————–

}

// DO NOT REMOVE. end of void myCode()

 

Performance Test 3 Code

Energy Recorded: 196 J

 

void myCode()

{

reverse(1); // reverses the spin of the motor 1

motorSpeed(4,40); // runs all motors at a constant speed (at 40% power)

goToAbsolutePosition(152); // for 152 marks

brake(4); // brakes all motors

goToAbsolutePosition(477);// continues brake until the AEV has reached an absolute position of 477 marks

rotateServo(110); // rotates the servo motor, breaking the AEV

brake(4); // brake all motors

goFor(9); // runs the brake command for 9 seconds

rotateServo(0);// rotates the servo motor, releasing the break from the AEV

motorSpeed(4,40); // runs all motors at a constant speed (at 40% power)

goToAbsolutePosition(625); // runs the last command until it reaches an absolute mark count of 625

brake(4); // brakes all motors

goFor(12); // runs the brake command for 12 seconds

reverse(4); // reverses all motors

celerate(4,0,40,2); // accelerates all motors from 0% to 40% power in 2 seconds

motorSpeed(4,40); // runs all motors at a constant speed (40% power)

goToAbsolutePosition(755); // runs the last command until it reaches an absolute mark count of 755

brake(4);// brakes all motors

goToAbsolutePosition(547);// repeats last command to mark 547

rotateServo(110);//  rotates the servo motor, breaking the AEV

brake(4); // brakes all motors

goFor(8); // repeats last command for 8 seconds

rotateServo(0);//  rotates the servo motor, releasing the AEV

celerate(4,0,40,2); // accelerates all motors from start to 40% power in 2 seconds

motorSpeed(4,40); // runs all motors at a constant speed (40% power)

goToAbsolutePosition(240);// runs command until the AEV reaches the 240 mark

brake(4);// brakes all motors

goToAbsolutePosition(15);// continues command until the AEV reaches mark 15

rotateServo(110); //rotates the servo motor, breaking the AEV

 

Final Code (Same code as PT 3)

Energy Recorded Run 1: 216 J

Energy Recorded Run 2: 312 J

Leave a Reply

Your email address will not be published. Required fields are marked *