things
Fork of LineFollower by
Embed:
(wiki syntax)
Show/hide line numbers
LineFollower.h
00001 #include "mbed.h" 00002 #include <stdint.h> 00003 00004 #ifndef MBED_LINEFOLLOWER_H 00005 #define MBED_LINEFOLLOWER_H 00006 00007 class LineFollower{ 00008 00009 public: 00010 /** Create a Line Follower interface for an IR Sensor Array 00011 * 00012 * @param ir1 IR Sensor 1 00013 * @param ir2 IR Sensor 2 00014 * @param ir3 IR Sensor 3 00015 * @param ir4 IR Sensor 4 00016 * @param ir5 IR Sensor 5 00017 * @param ir6 IR Sensor 6 00018 * @param ir7 IR Sensor 7 00019 * @param ir8 IR Sensor 8 00020 */ 00021 Linefollower(DigitalIn ir1, DigitalIn ir2, DigitalIn ir3, DigitalIn ir4, 00022 DigitalIn ir5, DigitalIn ir6, DigitalIn ir7, DigitalIn ir8); 00023 00024 00025 /** Read the value of a LineFollower object 00026 * 00027 * @return The value of the Sensor 00028 */ 00029 uint8_t read(); 00030 00031 /** Follow a line 00032 * 00033 * @param l left drive motor 00034 * @param r right drive motor 00035 */ 00036 void followLine(Motor l, Motor r); 00037 00038 protected: 00039 /* Constants */ 00040 #define ROTATE_SPEED 100 00041 #define MAXSPEED 1 00042 00043 /* Attributes */ 00044 DigitalIn array[8]; 00045 DigitalIn _ir1; 00046 DigitalIn _ir2; 00047 DigitalIn _ir3; 00048 DigitalIn _ir4; 00049 DigitalIn _ir5; 00050 DigitalIn _ir6; 00051 DigitalIn _ir7; 00052 DigitalIn _ir8; 00053 00054 00055 }; 00056 00057 #endif
Generated on Tue Jul 12 2022 21:28:47 by 1.7.2