Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

DriveController.h

Committer:
Hypna
Date:
2014-10-24
Revision:
9:01c17b286a99
Parent:
5:f53f06a866e9
Child:
10:210c8f1e3a92

File content as of revision 9:01c17b286a99:

#ifndef DRIVECONTROLLER_H
#define DRIVECONTROLLER_H
#include "mbed.h"
#include "LineSensors.h"
#include <fstream>

class DriveController
{
private:
    ofstream debugLog;
    
    PwmOut wheelSpeed1;
    PwmOut wheelSpeed2;
    PwmOut wheelSpeed3;
    PwmOut wheelSpeed4;
    
    DigitalOut wheelDirection1;
    DigitalOut wheelDirection2;
    DigitalOut wheelDirection3;
    DigitalOut wheelDirection4;
    
    I2CSlave i2c;
    
    LineSensors sensors;
    bool sensorStates[8][3];
    
    int command;
    int edge;
    
    void move(char direction = 'F');
    void getCommand();
    void rotate(char direction);
    void sendComplete();
    int calculateError();
    bool intersection();
    
public:
    DriveController();
    void go();
};

#endif