Program Basics

The parts of the AEV, specifically the Arduino board, were identified in exercise one. The group noted the components of the board such as the reset button, circuit board, start button, and the on/off switch. Then, the sample desktop stand was effectively constructed without any issues. The code for Scenario one was also successfully uploaded and ran on the desktop AEV. Coding basics were also discussed in this lab. While the group did not encounter any problems while coding Scenario 1, the group did learn more efficient ways of coding, such as copying and pasting the Scenario as a comment and ensuring to always comment the code, as well as to never forget a semicolon at the end of each line. In exercise one, the electric motors ran smoothly and efficiently. The propellers needed a starting push to get past the resistance, but after the first push they performed fine. The team did not need any guidance in this part of the lab, but further help was needed down the line in future exercises.

 

Code from Section 1 of Lab

//accelerates the first engine from start to 15% in 2.5 seconds
celerate(1,0,15,2.5);

//Run motor one at constant speed for 1 second
goFor(1);

//Brake motor 1
brake(1);

//accelerate motor 2 from start to 27% in 4 seconds
celerate(2,0,27,4);
//run motor 2 at constant speed for 2.7 seconds
goFor(2.7);
//Decelerate motor 2 to 15% power in 1 second
celerate(2,27,15,1);
//brake motor 2
brake(2);
//reverse direction of motor 2
reverse(2);
//accelerate all motors from start to 31% in 2 sec
celerate(1,0,31,2);
celerate(2,0,31,2);
//run all motors at a constant speed of 35% for 1 sec
motorSpeed(1,35);
motorSpeed(2,35);
goFor(1);
//brake all motors for 1 sec
brake(4);
goFor(1);
//reverse all direction of motor one
reverse(1);
//accelerate motor one from start to 19% over 2 sec
celerate(1,0,19,2);
//run motor 2 at 35% power while simultaneously running motor one at 19% power for 2 sec
motorSpeed(2,35);
motorSpeed(1,19);
goFor(2);
//run both motors at a constant speed for 2 sec
goFor(2);
//decelerate both motors to 0% power in 3 sec
celerate(1,19,0,3);
celerate(2,35,0,3);
//brake all motors
brake(4);