![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Code to run the microcontrollers on the R5 competition bot
Dependencies: LineSensors mbed
DriveController.h@13:aa6f64c73271, 2015-04-03 (annotated)
- Committer:
- Hypna
- Date:
- Fri Apr 03 23:02:38 2015 +0000
- Revision:
- 13:aa6f64c73271
- Parent:
- 12:edcae0f36e9c
- Child:
- 15:150ec9448efc
- Child:
- 16:b49db5c8e16c
updated
Who changed what in which revision?
User | Revision | Line number | New 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 | 13:aa6f64c73271 | 9 | PwmOut treadSpeed1; |
Hypna | 13:aa6f64c73271 | 10 | PwmOut treadSpeed2; |
Hypna | 2:d0ce8e26cbc4 | 11 | |
Hypna | 13:aa6f64c73271 | 12 | DigitalOut treadDirection1; |
Hypna | 13:aa6f64c73271 | 13 | DigitalOut treadDirection2; |
Hypna | 4:ac6b2e5b240b | 14 | |
Hypna | 5:f53f06a866e9 | 15 | I2CSlave i2c; |
Hypna | 4:ac6b2e5b240b | 16 | |
Hypna | 5:f53f06a866e9 | 17 | LineSensors sensors; |
Hypna | 5:f53f06a866e9 | 18 | bool sensorStates[8][3]; |
Hypna | 0:e60f22c1d573 | 19 | |
Hypna | 13:aa6f64c73271 | 20 | char command; |
Hypna | 0:e60f22c1d573 | 21 | |
Hypna | 5:f53f06a866e9 | 22 | void move(char direction = 'F'); |
Hypna | 2:d0ce8e26cbc4 | 23 | void getCommand(); |
Hypna | 5:f53f06a866e9 | 24 | void rotate(char direction); |
Hypna | 12:edcae0f36e9c | 25 | void spinTest(); |
Hypna | 4:ac6b2e5b240b | 26 | void sendComplete(); |
Hypna | 12:edcae0f36e9c | 27 | double calculateError(); |
Hypna | 2:d0ce8e26cbc4 | 28 | bool intersection(); |
Hypna | 0:e60f22c1d573 | 29 | |
Hypna | 0:e60f22c1d573 | 30 | public: |
Hypna | 2:d0ce8e26cbc4 | 31 | DriveController(); |
Hypna | 0:e60f22c1d573 | 32 | void go(); |
Hypna | 0:e60f22c1d573 | 33 | }; |
Hypna | 0:e60f22c1d573 | 34 | |
Hypna | 0:e60f22c1d573 | 35 | #endif |