Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

DriveController.h

Committer:
Hypna
Date:
2014-09-24
Revision:
1:fa6eb0c33b2f
Parent:
0:e60f22c1d573
Child:
2:d0ce8e26cbc4

File content as of revision 1:fa6eb0c33b2f:

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

enum Direction
{
    NORTH,
    SOUTH,
    EAST,
    WEST
};

class DriveController
{
private:
    DigitalOut wheel1(PTC1);
    DigitalOut wheel2(PTC2);
    DigitalOut wheel3(PTE29);
    DigitalOut wheel4(PTE30);
    
    DigitalIn floorSensor1(PTC7);
    DigitalIn floorSensor2(PTC0);
    DigitalIn floorSensor3(PTC3);
    DigitalIn floorSensor4(PTC4);
    DigitalIn floorSensor5(PTC5);
    DigitalIn floorSensor6(PTC6);
    DigitalIn floorSensor7(PTC10);
    DigitalIn floorSensor8(PTC11);
    DigitalIn floorSensor9(PTC9);
    DigitalIn floorSensor10(PTC8);
    DigitalIn floorSensor11(PTA5);
    DigitalIn floorSensor12(PTA4);
    DigitalIn floorSensor13(PTA12);
    DigitalIn floorSensor14(PTD4);
    DigitalIn floorSensor15(PTA2);
    DigitalIn floorSensor16(PTA1);
    DigitalIn floorSensor17(PTC12);
    DigitalIn floorSensor18(PTC13);
    DigitalIn floorSensor19(PTC16);
    DigitalIn floorSensor20(PTC17);
    DigitalIn floorSensor21(PTD2);
    DigitalIn floorSensor22(PTD0);
    DigitalIn floorSensor23(PTD5);
    DigitalIn floorSensor24(PTD13);
       
    Direction orientation = NORTH;
    
    bool sensorArray[24];
    
    void move(Direction);
    void readSensors();
    
public:
    void go();
};

#endif