Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

Committer:
Hypna
Date:
Mon Nov 03 16:51:27 2014 +0000
Revision:
10:210c8f1e3a92
Parent:
9:01c17b286a99
Child:
12:edcae0f36e9c
Removed Debug Log until we get a flash drive setup.; Changed pwm frequency for wheels to 20khz.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Hypna 0:e60f22c1d573 1 #ifndef DRIVECONTROLLER_H
Hypna 0:e60f22c1d573 2 #define DRIVECONTROLLER_H
Hypna 0:e60f22c1d573 3 #include "mbed.h"
Hypna 5:f53f06a866e9 4 #include "LineSensors.h"
Hypna 0:e60f22c1d573 5
Hypna 0:e60f22c1d573 6 class DriveController
Hypna 0:e60f22c1d573 7 {
Hypna 0:e60f22c1d573 8 private:
Hypna 4:ac6b2e5b240b 9 PwmOut wheelSpeed1;
Hypna 4:ac6b2e5b240b 10 PwmOut wheelSpeed2;
Hypna 4:ac6b2e5b240b 11 PwmOut wheelSpeed3;
Hypna 4:ac6b2e5b240b 12 PwmOut wheelSpeed4;
Hypna 2:d0ce8e26cbc4 13
Hypna 4:ac6b2e5b240b 14 DigitalOut wheelDirection1;
Hypna 4:ac6b2e5b240b 15 DigitalOut wheelDirection2;
Hypna 4:ac6b2e5b240b 16 DigitalOut wheelDirection3;
Hypna 4:ac6b2e5b240b 17 DigitalOut wheelDirection4;
Hypna 4:ac6b2e5b240b 18
Hypna 5:f53f06a866e9 19 I2CSlave i2c;
Hypna 4:ac6b2e5b240b 20
Hypna 5:f53f06a866e9 21 LineSensors sensors;
Hypna 5:f53f06a866e9 22 bool sensorStates[8][3];
Hypna 0:e60f22c1d573 23
Hypna 5:f53f06a866e9 24 int command;
Hypna 5:f53f06a866e9 25 int edge;
Hypna 0:e60f22c1d573 26
Hypna 5:f53f06a866e9 27 void move(char direction = 'F');
Hypna 2:d0ce8e26cbc4 28 void getCommand();
Hypna 5:f53f06a866e9 29 void rotate(char direction);
Hypna 4:ac6b2e5b240b 30 void sendComplete();
Hypna 5:f53f06a866e9 31 int calculateError();
Hypna 2:d0ce8e26cbc4 32 bool intersection();
Hypna 0:e60f22c1d573 33
Hypna 0:e60f22c1d573 34 public:
Hypna 2:d0ce8e26cbc4 35 DriveController();
Hypna 0:e60f22c1d573 36 void go();
Hypna 0:e60f22c1d573 37 };
Hypna 0:e60f22c1d573 38
Hypna 0:e60f22c1d573 39 #endif