TFC-Mentoring-Matters-Abstraction
RaceCar/Modes.h@0:0699eb71778e, 2014-07-16 (annotated)
- Committer:
- mrkeithcyr
- Date:
- Wed Jul 16 15:36:33 2014 +0000
- Revision:
- 0:0699eb71778e
First code commit.; Note known issue: in modes 1, 4, and 5 - The motor outputs are severely retarded by serial connection.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mrkeithcyr | 0:0699eb71778e | 1 | /****** RunMode0() ************************************************************* |
mrkeithcyr | 0:0699eb71778e | 2 | Purpose: Mode 0 is used for some very basic tests. It will test to see that the |
mrkeithcyr | 0:0699eb71778e | 3 | car is "turned on" by printing a message to the computer telling us that it |
mrkeithcyr | 0:0699eb71778e | 4 | is on. This mode also allows us to check that push buttons 'A' and 'B' are |
mrkeithcyr | 0:0699eb71778e | 5 | working and that the LEDs on the board are working. |
mrkeithcyr | 0:0699eb71778e | 6 | Most importantly, however, this quick and simple code will show us whether |
mrkeithcyr | 0:0699eb71778e | 7 | or not our CODE is working before we spend too much time writing the rest of |
mrkeithcyr | 0:0699eb71778e | 8 | the code. |
mrkeithcyr | 0:0699eb71778e | 9 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 10 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 11 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 12 | void RunMode0(); |
mrkeithcyr | 0:0699eb71778e | 13 | |
mrkeithcyr | 0:0699eb71778e | 14 | /****** RunMode1() ************************************************************* |
mrkeithcyr | 0:0699eb71778e | 15 | Purpose: Mode 1 isolates the drive motors on the rear wheels. The potentiometers |
mrkeithcyr | 0:0699eb71778e | 16 | on the board allow each motor to be adjusted individually. The numerical |
mrkeithcyr | 0:0699eb71778e | 17 | value that the pot represents is output to our computer so that we can |
mrkeithcyr | 0:0699eb71778e | 18 | gather some information about how the different values used for the drive |
mrkeithcyr | 0:0699eb71778e | 19 | settings will affect the direction and/or speed of the wheels. |
mrkeithcyr | 0:0699eb71778e | 20 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 21 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 22 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 23 | void RunMode1(); |
mrkeithcyr | 0:0699eb71778e | 24 | |
mrkeithcyr | 0:0699eb71778e | 25 | /****** RunMode2() ************************************************************* |
mrkeithcyr | 0:0699eb71778e | 26 | Purpose: Mode 2 isolates the steering servo. We are able to use a potentiometer |
mrkeithcyr | 0:0699eb71778e | 27 | on the board to adjust the steering settings left and right. The values |
mrkeithcyr | 0:0699eb71778e | 28 | being given to the steering servo are printed out to the computer so that |
mrkeithcyr | 0:0699eb71778e | 29 | they can be recorded and used later if necessary. |
mrkeithcyr | 0:0699eb71778e | 30 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 31 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 32 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 33 | void RunMode2(); |
mrkeithcyr | 0:0699eb71778e | 34 | |
mrkeithcyr | 0:0699eb71778e | 35 | /****** RunMode3() ************************************************************* |
mrkeithcyr | 0:0699eb71778e | 36 | Purpose: This function runs the camera test mode for the car. It disables the |
mrkeithcyr | 0:0699eb71778e | 37 | motors and steering servo to prevent damage to that hardware while isolating |
mrkeithcyr | 0:0699eb71778e | 38 | the camera output. First we check to see if the camera has an image ready |
mrkeithcyr | 0:0699eb71778e | 39 | for us to see and then we decode the camera image and translate it into a |
mrkeithcyr | 0:0699eb71778e | 40 | picture that can be displayed on the computer screen. The image on the |
mrkeithcyr | 0:0699eb71778e | 41 | screen can be used to focus the camera lens. Dip switch 4 can be turned off |
mrkeithcyr | 0:0699eb71778e | 42 | to output the original camera code to the screen if it is needed to test the |
mrkeithcyr | 0:0699eb71778e | 43 | camera in this mode. |
mrkeithcyr | 0:0699eb71778e | 44 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 45 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 46 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 47 | void RunMode3(); |
mrkeithcyr | 0:0699eb71778e | 48 | |
mrkeithcyr | 0:0699eb71778e | 49 | /****** RunMode4() ************************************************************* |
mrkeithcyr | 0:0699eb71778e | 50 | Purpose: Mode 4 is the first track mode. It takes all of the parts that we |
mrkeithcyr | 0:0699eb71778e | 51 | tested in modes 0 thru 3 and puts them together to [hopefully] make our car |
mrkeithcyr | 0:0699eb71778e | 52 | race around the track. Since we are still just testing the car, Mode 4 will |
mrkeithcyr | 0:0699eb71778e | 53 | limit the top speed of the car just in case something doesn't work. We don't |
mrkeithcyr | 0:0699eb71778e | 54 | want the car to crash into something too fast and break. |
mrkeithcyr | 0:0699eb71778e | 55 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 56 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 57 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 58 | void RunMode4(); |
mrkeithcyr | 0:0699eb71778e | 59 | |
mrkeithcyr | 0:0699eb71778e | 60 | /****** RunMode5() ************************************************************* |
mrkeithcyr | 0:0699eb71778e | 61 | Purpose: Mode 5 does exactly what mode 4 does, except that it does it FASTER. |
mrkeithcyr | 0:0699eb71778e | 62 | This makes the code VERY easy to write for Mode 5 |
mrkeithcyr | 0:0699eb71778e | 63 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 64 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 65 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 66 | void RunMode5(); |