Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

DriveController.h

Committer:
Hypna
Date:
2014-11-03
Revision:
10:210c8f1e3a92
Parent:
9:01c17b286a99
Child:
12:edcae0f36e9c

File content as of revision 10:210c8f1e3a92:

#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 sendComplete();
    int calculateError();
    bool intersection();
    
public:
    DriveController();
    void go();
};

#endif