EE149
/
FinalProject
Final Project files for mBed development.
project.h@7:6e5cc24e1ce7, 2014-11-13 (annotated)
- Committer:
- lsaristo
- Date:
- Thu Nov 13 05:02:37 2014 +0000
- Revision:
- 7:6e5cc24e1ce7
- Parent:
- 6:00b7198f0b51
Fixed bugs from previous changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lsaristo | 1:7e0243c27ecb | 1 | /** |
lsaristo | 1:7e0243c27ecb | 2 | * @file project.h |
lsaristo | 1:7e0243c27ecb | 3 | * @brief Main header file for includes and whatnot |
lsaristo | 1:7e0243c27ecb | 4 | * for the other project files. |
lsaristo | 1:7e0243c27ecb | 5 | * @author John Wilkey |
lsaristo | 1:7e0243c27ecb | 6 | */ |
lsaristo | 1:7e0243c27ecb | 7 | |
lsaristo | 1:7e0243c27ecb | 8 | #ifndef _PROJECT_H |
lsaristo | 1:7e0243c27ecb | 9 | #define _PROJECT_H |
lsaristo | 1:7e0243c27ecb | 10 | |
lsaristo | 1:7e0243c27ecb | 11 | #include <stdio.h> |
John Wilkey |
5:01882c3de2dc | 12 | #include "mbed.h" |
lsaristo | 3:d744a6e2c4c0 | 13 | #include "m3pi.h" |
John Wilkey |
5:01882c3de2dc | 14 | #define TURN_SPEED 0.25 |
John Wilkey |
6:00b7198f0b51 | 15 | #define DRIVE_SPEED 0.5 |
John Wilkey |
5:01882c3de2dc | 16 | #define ERR_SUCCESS 0 |
John Wilkey |
5:01882c3de2dc | 17 | #define ERR_FAILURE 1 |
John Wilkey |
5:01882c3de2dc | 18 | |
John Wilkey |
5:01882c3de2dc | 19 | /** |
John Wilkey |
5:01882c3de2dc | 20 | * @brief Provides access to the digital outputs on the mbed controller. |
John Wilkey |
5:01882c3de2dc | 21 | * |
John Wilkey |
5:01882c3de2dc | 22 | * Note that by default these output pins are hardwired to the 6 LEDs that |
John Wilkey |
5:01882c3de2dc | 23 | * stripe the development extension board. |
John Wilkey |
5:01882c3de2dc | 24 | */ |
lsaristo | 7:6e5cc24e1ce7 | 25 | |
lsaristo | 7:6e5cc24e1ce7 | 26 | |
lsaristo | 1:7e0243c27ecb | 27 | |
lsaristo | 1:7e0243c27ecb | 28 | /** |
lsaristo | 1:7e0243c27ecb | 29 | * @brief Driver forward. |
lsaristo | 1:7e0243c27ecb | 30 | * |
lsaristo | 1:7e0243c27ecb | 31 | * @param[in] amt Amount to drive forward. |
lsaristo | 1:7e0243c27ecb | 32 | * @param[in] spd Drive speed. |
John Wilkey |
5:01882c3de2dc | 33 | * @return Success or failure. |
lsaristo | 1:7e0243c27ecb | 34 | */ |
lsaristo | 7:6e5cc24e1ce7 | 35 | int forward(float amt, float spd); |
lsaristo | 1:7e0243c27ecb | 36 | |
lsaristo | 1:7e0243c27ecb | 37 | /** |
lsaristo | 1:7e0243c27ecb | 38 | * @brief Drive backward. |
lsaristo | 1:7e0243c27ecb | 39 | * |
lsaristo | 1:7e0243c27ecb | 40 | * @param[in] amt Amount to drive backward. |
lsaristo | 1:7e0243c27ecb | 41 | * @param[in] spd Drive speed. |
John Wilkey |
5:01882c3de2dc | 42 | * @return Success or failure. |
lsaristo | 1:7e0243c27ecb | 43 | */ |
lsaristo | 7:6e5cc24e1ce7 | 44 | int backward(float amt, float spd); |
lsaristo | 1:7e0243c27ecb | 45 | |
lsaristo | 1:7e0243c27ecb | 46 | /** |
lsaristo | 1:7e0243c27ecb | 47 | * @brief Turn right. |
lsaristo | 1:7e0243c27ecb | 48 | * |
lsaristo | 1:7e0243c27ecb | 49 | * @param[in] deg Desired final turn angle from starting position. |
lsaristo | 1:7e0243c27ecb | 50 | * @param[in] spd Desired turning speed. |
John Wilkey |
5:01882c3de2dc | 51 | * @return Success or failure. |
lsaristo | 1:7e0243c27ecb | 52 | */ |
lsaristo | 1:7e0243c27ecb | 53 | int right(float deg); |
lsaristo | 1:7e0243c27ecb | 54 | |
lsaristo | 1:7e0243c27ecb | 55 | /** |
lsaristo | 1:7e0243c27ecb | 56 | * @brief Turn left. |
lsaristo | 1:7e0243c27ecb | 57 | * |
lsaristo | 1:7e0243c27ecb | 58 | * @param[in] deg Desired final turn angle from starting position. |
lsaristo | 1:7e0243c27ecb | 59 | * @param[in] spd Desired turning speed. |
John Wilkey |
5:01882c3de2dc | 60 | * @return Success or failure. |
lsaristo | 1:7e0243c27ecb | 61 | */ |
John Wilkey |
5:01882c3de2dc | 62 | int left (float deg); |
lsaristo | 1:7e0243c27ecb | 63 | |
lsaristo | 1:7e0243c27ecb | 64 | /** |
lsaristo | 2:c2764165a23d | 65 | * @brief Controller decision logic. |
lsaristo | 1:7e0243c27ecb | 66 | * |
lsaristo | 1:7e0243c27ecb | 67 | * Decide what to do next based on the status of the drawing so far. |
lsaristo | 1:7e0243c27ecb | 68 | * |
lsaristo | 1:7e0243c27ecb | 69 | */ |
John Wilkey |
5:01882c3de2dc | 70 | void next_action(); |
lsaristo | 1:7e0243c27ecb | 71 | |
John Wilkey |
5:01882c3de2dc | 72 | /** |
John Wilkey |
5:01882c3de2dc | 73 | * @brief Print a formatted message to the LCD |
John Wilkey |
5:01882c3de2dc | 74 | */ |
John Wilkey |
5:01882c3de2dc | 75 | void pretty_print(char* msg); |
John Wilkey |
5:01882c3de2dc | 76 | |
John Wilkey |
5:01882c3de2dc | 77 | |
John Wilkey |
5:01882c3de2dc | 78 | |
John Wilkey |
5:01882c3de2dc | 79 | #endif |