A LineFollower library for ASEE-2014
LineFollower.h@0:2623af9e8ef3, 2014-02-18 (annotated)
- Committer:
- blu12758
- Date:
- Tue Feb 18 04:14:48 2014 +0000
- Revision:
- 0:2623af9e8ef3
- Child:
- 1:c319e24af8df
First commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
blu12758 | 0:2623af9e8ef3 | 1 | #include "mbed.h" |
blu12758 | 0:2623af9e8ef3 | 2 | #include <stdint.h> |
blu12758 | 0:2623af9e8ef3 | 3 | |
blu12758 | 0:2623af9e8ef3 | 4 | #ifndef MBED_LINEFOLLOWER_H |
blu12758 | 0:2623af9e8ef3 | 5 | #define MBED_LINEFOLLOWER_H |
blu12758 | 0:2623af9e8ef3 | 6 | |
blu12758 | 0:2623af9e8ef3 | 7 | class LineFollower{ |
blu12758 | 0:2623af9e8ef3 | 8 | |
blu12758 | 0:2623af9e8ef3 | 9 | public: |
blu12758 | 0:2623af9e8ef3 | 10 | /** Create a Line Follower interface for an IR Sensor Array |
blu12758 | 0:2623af9e8ef3 | 11 | * |
blu12758 | 0:2623af9e8ef3 | 12 | * @param ir1 IR Sensor 1 |
blu12758 | 0:2623af9e8ef3 | 13 | * @param ir2 IR Sensor 2 |
blu12758 | 0:2623af9e8ef3 | 14 | * @param ir3 IR Sensor 3 |
blu12758 | 0:2623af9e8ef3 | 15 | * @param ir4 IR Sensor 4 |
blu12758 | 0:2623af9e8ef3 | 16 | * @param ir5 IR Sensor 5 |
blu12758 | 0:2623af9e8ef3 | 17 | * @param ir6 IR Sensor 6 |
blu12758 | 0:2623af9e8ef3 | 18 | * @param ir7 IR Sensor 7 |
blu12758 | 0:2623af9e8ef3 | 19 | * @param ir8 IR Sensor 8 |
blu12758 | 0:2623af9e8ef3 | 20 | */ |
blu12758 | 0:2623af9e8ef3 | 21 | Linefollower(DigitalIn ir1, DigitalIn ir2, DigitalIn ir3, DigitalIn ir4, |
blu12758 | 0:2623af9e8ef3 | 22 | DigitalIn ir5, DigitalIn ir6, DigitalIn ir7, DigitalIn ir8); |
blu12758 | 0:2623af9e8ef3 | 23 | |
blu12758 | 0:2623af9e8ef3 | 24 | |
blu12758 | 0:2623af9e8ef3 | 25 | /** Read the value of a LineFollower object |
blu12758 | 0:2623af9e8ef3 | 26 | * |
blu12758 | 0:2623af9e8ef3 | 27 | * @return The value of the Sensor |
blu12758 | 0:2623af9e8ef3 | 28 | */ |
blu12758 | 0:2623af9e8ef3 | 29 | uint8_t read(); |
blu12758 | 0:2623af9e8ef3 | 30 | |
blu12758 | 0:2623af9e8ef3 | 31 | protected: |
blu12758 | 0:2623af9e8ef3 | 32 | |
blu12758 | 0:2623af9e8ef3 | 33 | #define ROTATE_SPEED 100 |
blu12758 | 0:2623af9e8ef3 | 34 | #define MAXSPEED 200 |
blu12758 | 0:2623af9e8ef3 | 35 | int array[8] {0,0,0,0,0,0,0,0}; |
blu12758 | 0:2623af9e8ef3 | 36 | DigitalIn _ir1; |
blu12758 | 0:2623af9e8ef3 | 37 | DigitalIn _ir2; |
blu12758 | 0:2623af9e8ef3 | 38 | DigitalIn _ir3; |
blu12758 | 0:2623af9e8ef3 | 39 | DigitalIn _ir4; |
blu12758 | 0:2623af9e8ef3 | 40 | DigitalIn _ir5; |
blu12758 | 0:2623af9e8ef3 | 41 | DigitalIn _ir6; |
blu12758 | 0:2623af9e8ef3 | 42 | DigitalIn _ir7; |
blu12758 | 0:2623af9e8ef3 | 43 | DigitalIn _ir8; |
blu12758 | 0:2623af9e8ef3 | 44 | |
blu12758 | 0:2623af9e8ef3 | 45 | |
blu12758 | 0:2623af9e8ef3 | 46 | }; |
blu12758 | 0:2623af9e8ef3 | 47 | |
blu12758 | 0:2623af9e8ef3 | 48 | #endif |