Create this program
Dependencies: mbed HCSR04 HMC6352 PID TextLCD
Diff: line.h
- Revision:
- 5:e07e380ddb93
- Parent:
- 3:901d18b901b4
--- a/line.h Fri Aug 07 06:51:51 2015 +0000 +++ b/line.h Sat Aug 08 12:39:18 2015 +0000 @@ -1,5 +1,5 @@ /** - * @file : line.h (0.1) + * @file : line.h (1.0) * @brief : find white line * @author : Shinnosuke KOIKE * @date : 2015/08/07 @@ -11,7 +11,38 @@ #include "mbed.h" class Line { - +public: + Line(PinName right, PinName back, PinName left); + char findOnLine(void); + +private: + BusIn lineData; }; -#endif \ No newline at end of file +// initialize +Line::Line(PinName right, PinName back, PinName left): + lineData(right, back, left) { +} + +// return data which if the robot get on white line +char Line::findOnLine(void) { + char data = lineData; + return data; +} + +#endif + +/** + * example program + +#include "mbed.h" +#include "line.h" + +int main(void) { + Line line(D0, D1, D2); + while (1) { + char data = line.findOnLine(); + pc.printf("%d\r\n", data); // for example, display "1 0 0" + } +} + */