A LineFollower library for ASEE-2014
LineFollower.cpp
- Committer:
- blu12758
- Date:
- 2014-02-18
- Revision:
- 0:2623af9e8ef3
- Child:
- 1:c319e24af8df
File content as of revision 0:2623af9e8ef3:
#include "LineFollower.h" #include "mbed.h" #include <stdint.h> /** Create a Line Follower interface for an IR Sensor Array * * @param ir1 IR Sensor 1 * @param ir2 IR Sensor 2 * @param ir3 IR Sensor 3 * @param ir4 IR Sensor 4 * @param ir5 IR Sensor 5 * @param ir6 IR Sensor 6 * @param ir7 IR Sensor 7 * @param ir8 IR Sensor 8 */ LineFollower::Linefollower(DigitalIn ir1, DigitalIn ir2, DigitalIn ir3, DigitalIn ir4, DigitalIn ir5, DigitalIn ir6, DigitalIn ir7, DigitalIn ir8): _ir1(ir1), _ir2(ir2), _ir3(ir3), _ir4(ir4), _ir5(ir5), _ir6(ir6), _ir7(ir7), _ir8(ir8){ } /** Read the value of a LineFollower object * * @return The value of the Sensor */ uint8_t LineFollower::read(){ uint8_t binary = 0; array[0] = _ir1; array[1] = _ir2; array[2] = _ir3; array[3] = _ir4; array[4] = _ir5; array[5] = _ir6; array[6] = _ir7; array[7] = _ir8; for(int i=0; i<=8; i++){ binary += array[i] } }