Lab 8 Arduino Code

Prototype 1: Full Bottle

//reflectanceSensorTest(); //Test the reflectance sensors

reverse(4);    //Reverse the polarity of all motors

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

goFor(2);      //Continue previous command for 2 seconds

motorSpeed(4,25);   //Run all motors at a constant speed of 25%power

goToAbsolutePosition(335);   //Travel a total distance of 13.6 feet (from the starting point).

reverse(4);     //Reverse the polarity of all motors     

motorSpeed(4,35);    //Run all motors at a constant speed of 35% power

goFor(1);      //Continue previous command for 1 second

brake(4);      //Remove power from all motors

 

Prototype 2: Half Bottle

//reflectanceSensorTest(); //Test the reflectance sensors

reverse(4); //Reverse the polarity of all motors

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

goFor(2);      //Continue previous command for 2 seconds

motorSpeed(4,25);   //Run all motors at a constant speed of 25%power

goToAbsolutePosition(310); //Travel a total distance of 12.6 feet (from the starting point).

reverse(4);     //Reverse the polarity of all motors  

motorSpeed(4,35);    //Run all motors at a constant speed of 35% power

goFor(2);      //Continue previous command for 1 second

brake(4);      //Remove power from all motors