Code to run the microcontrollers on the R5 competition bot
Dependencies: LineSensors mbed
DriveController.h
- Committer:
- Hypna
- Date:
- 2014-10-14
- Revision:
- 4:ac6b2e5b240b
- Parent:
- 3:0d7687b6ef14
- Child:
- 5:f53f06a866e9
File content as of revision 4:ac6b2e5b240b:
#ifndef DRIVECONTROLLER_H #define DRIVECONTROLLER_H #include "mbed.h" #include <string> #include <list> enum Direction { NORTH, SOUTH, EAST, WEST }; struct Command { Direction direction; int distance; }; class DriveController { private: PwmOut wheelSpeed1; PwmOut wheelSpeed2; PwmOut wheelSpeed3; PwmOut wheelSpeed4; DigitalOut wheelDirection1; DigitalOut wheelDirection2; DigitalOut wheelDirection3; DigitalOut wheelDirection4; list <DigitalInOut> sensors; I2C i2c; bool sensorStates[24]; Direction orientation; Command command; void move(); void getCommand(); void rotate(Direction); void forward(double); void readSensors(); void sendComplete(); double calculateError(); bool intersection(); public: DriveController(); void go(); }; #endif