Evolution of Design

Lab 1 – Introduction to Coding for Arduino

//Accelerate motor one
celerate(1,0,15,2.5);

//Run for 1 second
goFor(1);

//Brake the motor
brake(1);

//Accelerate motor 2
celerate(2,0,27,4);

//Keep running it
goFor(2.7);

//Decelerate motor 2
celerate(2,27,15,1);

//Brake motor 2
brake(2);

//Reverse motor 2
reverse(2);

//Accelerate both motors
celerate(4,0,31,2);

//Run all motors
motorSpeed(4,35);
goFor(1);

//Brake motor 2 and continue motor 1
brake(2);
goFor(3);

//Brake all for 1 second
brake(1);
goFor(1);

//Reverse direction of motor 1
reverse(1);

//Accelerate motor 1
celerate(1,0,19,2);

//Run motor 2 and 1 at constant but different speeds
motorSpeed(1,19);
motorSpeed(2,35);
goFor(2);

//Run both at same speed
motorSpeed(4,19);
goFor(2);

//Decelerate both to a stop
celerate(4,19,0,3);

//Brake both
brake(4);

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

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

 

Lab 2 – Testing Reflectance Sensor

reflectanceSensorTest();

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

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

 

Lab 2 – Using Reflectance Sensor

//Run at constant speed
motorSpeed(4,25);
goFor(2);

//Run at constant speed to an absolute position of 12 ft.
motorSpeed(4,20);
goToAbsolutePosition(296);

//Reverse motors
reverse(4);

//Run at constant speed
motorSpeed(4,30);
goFor(1.5);

//Brake all motors
brake(4);

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

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

 

Lab 3 – Test Run

//Accelerate all motors
celerate(4,0,25,3);

//Run at constant speed for one second
motorSpeed(4,25);
goFor(1);

//Run at a slower speed for two seconds
motorSpeed(4,20);
goFor(2);

//Reverse all motors
reverse(4);

//Run at constant speed for two seconds
motorSpeed(4,25);
goFor(2);

//Brake all motors
brake(4);

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

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