![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Code to run the microcontrollers on the R5 competition bot
Dependencies: LineSensors mbed
navcontroller.h
- Committer:
- jmar11
- Date:
- 2015-04-18
- Revision:
- 17:5046b27f5441
- Child:
- 19:9f4510646c9e
File content as of revision 17:5046b27f5441:
#ifndef NAVCONTROLLER_H #define NAVCONTROLLER_H #include "r5map.h" #include <stack> #include <vector> #define SENS_FORWARD 7 #define SENS_RIGHT 0 #define SENS_BACK 2 #define SENS_LEFT 3 #define PIN_INT_1 4 #define PIN_INT_2 5 #define FRDM_ADD 0x0A class NavController { public: NavController(int mapSize = 5); void explore(); //moves bot through the unknown maze void goBack(); //returns bot to the origin void saveMap(); //saves map information to file void pinWrite(int, int); void waitingForInterrupt(int, int); void testWithDelay(); void testWithoutDelay(); private: typename ::position end; typename ::direction nextExploreMove(); //calculates the next move in maze exploration void sendMove(typename ::direction next); //sends a move command to the freedom board via i2c void updateMap(); //records all the sensor information into the map object bool readSensor(typename ::direction wall); //returns true if there is a wall in direction "wall" char readWall(typename ::direction wall); //returns the character written on the wall in the direction of 'wall' typename ::R5Map map; typename ::direction orient; //current orientation of the bot stack<typename ::direction> path; //a record of the bots path void initIO(); }; #endif