First team commit
Fork of LineFollower by
LineFollower.h@6:3482f3f93988, 2014-03-06 (annotated)
- Committer:
- cbradford
- Date:
- Thu Mar 06 02:34:37 2014 +0000
- Revision:
- 6:3482f3f93988
- Parent:
- 4:2abe380c57f1
- Child:
- 9:039a74519b89
Return count;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
blu12758 | 4:2abe380c57f1 | 1 | #include "Motor.h" |
blu12758 | 0:2623af9e8ef3 | 2 | #include "mbed.h" |
blu12758 | 0:2623af9e8ef3 | 3 | #include <stdint.h> |
blu12758 | 0:2623af9e8ef3 | 4 | |
blu12758 | 0:2623af9e8ef3 | 5 | #ifndef MBED_LINEFOLLOWER_H |
blu12758 | 0:2623af9e8ef3 | 6 | #define MBED_LINEFOLLOWER_H |
blu12758 | 0:2623af9e8ef3 | 7 | |
blu12758 | 0:2623af9e8ef3 | 8 | class LineFollower{ |
blu12758 | 0:2623af9e8ef3 | 9 | |
blu12758 | 0:2623af9e8ef3 | 10 | public: |
blu12758 | 0:2623af9e8ef3 | 11 | /** Create a Line Follower interface for an IR Sensor Array |
blu12758 | 0:2623af9e8ef3 | 12 | * |
blu12758 | 0:2623af9e8ef3 | 13 | * @param ir1 IR Sensor 1 |
blu12758 | 0:2623af9e8ef3 | 14 | * @param ir2 IR Sensor 2 |
blu12758 | 0:2623af9e8ef3 | 15 | * @param ir3 IR Sensor 3 |
blu12758 | 0:2623af9e8ef3 | 16 | * @param ir4 IR Sensor 4 |
blu12758 | 0:2623af9e8ef3 | 17 | * @param ir5 IR Sensor 5 |
blu12758 | 0:2623af9e8ef3 | 18 | * @param ir6 IR Sensor 6 |
blu12758 | 0:2623af9e8ef3 | 19 | * @param ir7 IR Sensor 7 |
blu12758 | 0:2623af9e8ef3 | 20 | * @param ir8 IR Sensor 8 |
blu12758 | 0:2623af9e8ef3 | 21 | */ |
blu12758 | 4:2abe380c57f1 | 22 | LineFollower(PinName ir1, PinName ir2, PinName ir3, PinName ir4, |
blu12758 | 4:2abe380c57f1 | 23 | PinName ir5, PinName ir6, PinName ir7, PinName ir8); |
blu12758 | 0:2623af9e8ef3 | 24 | |
blu12758 | 0:2623af9e8ef3 | 25 | |
blu12758 | 0:2623af9e8ef3 | 26 | /** Read the value of a LineFollower object |
blu12758 | 0:2623af9e8ef3 | 27 | * |
blu12758 | 0:2623af9e8ef3 | 28 | * @return The value of the Sensor |
blu12758 | 0:2623af9e8ef3 | 29 | */ |
blu12758 | 0:2623af9e8ef3 | 30 | uint8_t read(); |
blu12758 | 1:c319e24af8df | 31 | |
blu12758 | 1:c319e24af8df | 32 | /** Follow a line |
blu12758 | 1:c319e24af8df | 33 | * |
blu12758 | 1:c319e24af8df | 34 | * @param l left drive motor |
blu12758 | 1:c319e24af8df | 35 | * @param r right drive motor |
blu12758 | 1:c319e24af8df | 36 | */ |
cbradford | 6:3482f3f93988 | 37 | int followLine(Motor l, Motor r); |
blu12758 | 0:2623af9e8ef3 | 38 | |
blu12758 | 0:2623af9e8ef3 | 39 | protected: |
blu12758 | 1:c319e24af8df | 40 | /* Constants */ |
blu12758 | 0:2623af9e8ef3 | 41 | #define ROTATE_SPEED 100 |
blu12758 | 1:c319e24af8df | 42 | #define MAXSPEED 1 |
blu12758 | 1:c319e24af8df | 43 | |
blu12758 | 1:c319e24af8df | 44 | /* Attributes */ |
blu12758 | 4:2abe380c57f1 | 45 | BusIn array; |
blu12758 | 0:2623af9e8ef3 | 46 | |
blu12758 | 0:2623af9e8ef3 | 47 | |
blu12758 | 0:2623af9e8ef3 | 48 | }; |
blu12758 | 0:2623af9e8ef3 | 49 | |
blu12758 | 0:2623af9e8ef3 | 50 | #endif |