Programming the dragster
The code for this project is designed to achieve the following objectives:
- The dragster needs to count down 3-2-1 to make sure people have time to move out of the way.
- The dragster needs to stop when it sees the red finish line.
- The dragster needs to display the time to avoid human error when using a stopwatch.
The ports
Before we begin to code, you need to make sure you have all the parts properly connected to the Intelligent Hub. Start with the motors. The motors should be plugged into ports B and F. It does not matter which motor goes into which port as long as they are B and F. Both motors will simply move forward.
You will next connect your color sensor to the Intelligent Hub by clipping into part A. This sensor will help us stop at the finish line.
Dragster code program
In this section, you will walk through how to program the dragster to count down 3-2-1 and then take off at full throttle to achieve the fastest time...