Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

DriveController.h

Committer:
Hypna
Date:
2014-11-14
Revision:
12:edcae0f36e9c
Parent:
10:210c8f1e3a92
Child:
13:aa6f64c73271

File content as of revision 12:edcae0f36e9c:

#ifndef DRIVECONTROLLER_H
#define DRIVECONTROLLER_H
#include "mbed.h"
#include "LineSensors.h"

class DriveController
{
private:
    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 spinTest();
    void sendComplete();
    double calculateError();
    bool intersection();
    
public:
    DriveController();
    void go();
};

#endif