This is Division B’s Code Archive. As the project develops, we’ll be updating this page with code snippets and programs used during research and development.
Only the most recent code will be published here. Older code will be stored in a archive folder that you can access here*.
The folder is organized by date the code was created, and all updates to the code will be recorded via a ReadMe.txt file within each folder.
Here is a link to a glossary of the Arduino function calls that are used within the programs.
Code from April 13, 2018:
//Code for Performance Test 3 void pTest3() { const float slope_dist = pow((16 + 1 / 144), .5); const float total_dist = 20 + 2 * slope_dist; float dist = 0; //First straight + First Incline reverse(4); motorSpeed(4, 45); dist = 12 * 8.5; goToAbsolutePosition(convertInchesToMarks(dist)); //Gate : visit 1 brake(4); goFor(.72); reverse(4); motorSpeed(4, 59); goFor(.72); brake(4); goFor(8); //Exit Gate reverse(4); motorSpeed(4, 50); goFor(2); //First downslope dist = 12 * 20; motorSpeed(4, 10); goToAbsolutePosition(convertInchesToMarks(dist)); brake(4); dist = 12 * 21.5; goToAbsolutePosition(convertInchesToMarks(dist)); //Last straight and Connect To Caboose reverse(4); motorSpeed(4, 34);//45 goFor(.8); motorSpeed(4, 0); goFor(8); //Return trip (i.e. the same, but backwards, as above.) motorSpeed(4, 57); dist = 21 * 12; goToAbsolutePosition(convertInchesToMarks(dist)); //Gate : visit 2 brake(4); dist = 19 * 12; goToAbsolutePosition(convertInchesToMarks(dist)); //First Brake reverse(4); motorSpeed(4, 70); goFor(.8); brake(4); //Second Brake dist = 14.3 * 12; motorSpeed(4, 42); goFor(.7); brake(4); goFor(9); //Exit Gate reverse(4); motorSpeed(4, 45); dist = 12 * 10.5; goToAbsolutePosition(convertInchesToMarks(dist)); //Cut Motors dist = 12 * 9; goToAbsolutePosition(convertInchesToMarks(dist)); brake(4); //Power Braking at the Finish reverse(4); motorSpeed(4, 60); goFor(1); brake(4); }
Helpful Links
*Note: You’ll have to log in with your OSU Credentials in order to view them for now (we’re working on that).