EE149
/
FinalProject
Final Project files for mBed development.
main.h
- Committer:
- alecguertin
- Date:
- 2014-12-08
- Revision:
- 28:9976a94efa83
- Parent:
- 22:46b9d9b2e35c
- Child:
- 29:459ff10d2a07
File content as of revision 28:9976a94efa83:
/** * @file main.h * @brief Main header file for includes and whatnot * for the other project files. * @author John Wilkey */ #ifndef _MAIN_H #define _MAIN_H #include "mbed.h" #include "m3pi.h" #include <string.h> #include <stdarg.h> #include <stdio.h> #include <math.h> #define TURN_SPEED 0.15 #define DRIVE_SPEED 0.2 #define ERR_SUCCESS 0 #define ERR_FAILURE 1 #define DRIVE_RATE 1/50 #define TIME_FACT 1820 #define CAL_SPEED .1 #define CLOSE_ENOUGH .0008 /** * @brief move the robot from its current position to (x,y) * */ void move(int x, int y, int draw); /** * @brief get values of next PostScript instruction. * * @param buf Buffer with PS instructions. * @param x Pointer to storage for x coordinate. * @param y Pointer to storage for y coordinate. * @param draw Pointer to storage for draw/move boolean. * * @return Success or failure code. */ int retrieve_inst(char *buf, int *x, int *y, int *draw); /** * @brief Driver forward. * * @param[in] amt Amount to drive forward. In centimeters. * @return Success or failure. */ int forward(int amt); /** * @brief Drive backward. * * @param[in] amt Amount to drive backward. In centimeters. * @return Success or failure. */ int backward(int amt); /** * @brief Turn right. * * @param[in] deg Desired final turn angle from starting position. * @param[in] spd Desired turning speed. * @return Success or failure. */ int right(float deg); /** * @brief Turn left. * * @param[in] deg Desired final turn angle from starting position. * @param[in] spd Desired turning speed. * @return Success or failure. */ int left (float deg); /** * @brief Enable pen motion. * * Note that at the moment, for simplicity, this method just activates an LED * on the expansion board to indicate that the pen should be in DOWN mode. */ void pen_down(); /** * @brief Raise pen */ void pen_up(); /** * @brief Controller decision logic. * * Decide what to do next based on the status of the drawing so far. */ void next_action(); /** * @brief Wait for a number of seconds, possibly fractional. * * This is because mBed wait() function SUCKS */ void timerWait(float); #endif