Simple Driving DRY - Dutton-Christian-Robotics/Learning-to-Code GitHub Wiki
One of the most common words of wisdom in programming is "don't repeat yourself"—or DRY. There are many reasons that this is an important principle.
- The more you repeat yourself—that is, writing the same code over and over—the more places and opportunities there are to make mistakes.
- If there are basic things that you always do over and over, there are opportunities for saving time, lines of code, and helping you to focus on a higher level of programming by taking repeated code, simplifying it, and turning it into a function/method.
Rather than have separate power motor commands, have a drive function that calls them all together. Also create a reverse method and a stop driving method.
Use a for loop to go forward and stop multiple times.
Figure out how to work in showing a while() and do while() loops.