Arduino Codes for Experiments

The codes listed have been used in our experiments, and a description of each code shall be provided.

 

Lab 1 Code:

 

celerate(1,0,15,2.5);

motorSpeed(1,15);

goFor(1);

brake(1);

celerate(2,0,27,4);

motorSpeed(2,27);

goFor(2.7);

celerate(2,27,15,1);

brake(2);

reverse(2);

celerate(4,0,31,2);

motorSpeed(4,35);

goFor(1);

break(2);

motorSpeed(1,35);

goFor(3);

break(4);

goFor(1);

reverse(1);

celerate(1,0,19,2);

motorSpeed(2,35);

motorSpeed(1,19);

goFor(2);

motorSpeed(4,19);

goFor(2);

celerate(4,19,0,3);

brake(4);

 

This code accelerates motor 1 from speed 0 to 15% power in 2.5 seconds. Next, the motor speed for motor 1 is set to 15%, and it goes for 1 second. Then, motor 1 is cut from the power. It then accelerates motor 2 from 0 to 27% power in 4 seconds. The speed for motor 2 is set to 27% power, and goes or 2.7 seconds. Motor 2 is then decelerated from 27% to 15% power in a second. Motor 2 is then cut from power, and the motor is reversed. All motors are then accelerated from 0 to 31% power in 2 seconds. All motors are set for 35% power and go for a second. Motor 2 is then cut from the power. Motor 1 is then set to 35% power and goes for 3 seconds. All motors are then cut from the power, and the AEV coasts for a second. Motor 1 is then put in reverse, and it goes from 0 to 19% power in 2 seconds. Motor 2 is set to 35% power, and motor 1 is set for 19% power. It goes for 2 seconds. All motors are set to 19% power. It goes for 2 seconds. All motors go from 19% power to 0% in 3 seconds, then all the motors are cut from the power.

 

Lab 2 Code:

 

motorSpeed(4,25);

goFor(2);

motorSpeed(4,20);

goToAbosolutPosition(295.38);

reverse(4);

motorSpeed(4,30);

goFor(1.5);

brake(4);

 

All motors are set to 25% power, and it goes for 2 seconds. All the motors are set at 20% power, and the AEV goes to the position 295.38 inches from the starting point. All motors are put in revers, and they are set at 30% power. It goes for a second and a half, then the power is cut from all motors.

 

Lab 4 Data Analysis Tool Code (CSS1):

celerate(4,0,25,3);

motorSpeed(4, 25);

goFor(1);

motorSpeed(4,20);

goFor(2);

reverse(4);

motorSpeed(4,25);

goFor(2);

brake(4);

 

The code shows all motors accelerating in 3 seconds from 0-25% power. They then run for 25% speed for a second, then drop down to 20% power and run at that for 2 seconds. The motors are then reversed then run at 25% power for 2 seconds. The motors are all then cut from the power.