It is a test program of wallbot mini library.
Dependencies: mbed wallbotmini
main.cpp@0:37a76b1e82dc, 2013-11-02 (annotated)
- Committer:
- jksoft
- Date:
- Sat Nov 02 01:06:09 2013 +0000
- Revision:
- 0:37a76b1e82dc
Rev1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:37a76b1e82dc | 1 | #include "mbed.h" |
jksoft | 0:37a76b1e82dc | 2 | #include "wallbotmini.h" |
jksoft | 0:37a76b1e82dc | 3 | |
jksoft | 0:37a76b1e82dc | 4 | wallbotmini wb; |
jksoft | 0:37a76b1e82dc | 5 | |
jksoft | 0:37a76b1e82dc | 6 | int main() { |
jksoft | 0:37a76b1e82dc | 7 | |
jksoft | 0:37a76b1e82dc | 8 | wb.sensor_calibrate(); |
jksoft | 0:37a76b1e82dc | 9 | |
jksoft | 0:37a76b1e82dc | 10 | while(!wb.GetSw()) |
jksoft | 0:37a76b1e82dc | 11 | { |
jksoft | 0:37a76b1e82dc | 12 | wb.set_led(wb.GetLinePosition()); |
jksoft | 0:37a76b1e82dc | 13 | } |
jksoft | 0:37a76b1e82dc | 14 | |
jksoft | 0:37a76b1e82dc | 15 | wb.forward(1.0); |
jksoft | 0:37a76b1e82dc | 16 | wait (1.0); |
jksoft | 0:37a76b1e82dc | 17 | wb.left(1.0); |
jksoft | 0:37a76b1e82dc | 18 | wait (1.0); |
jksoft | 0:37a76b1e82dc | 19 | wb.backward(1.0); |
jksoft | 0:37a76b1e82dc | 20 | wait (1.0); |
jksoft | 0:37a76b1e82dc | 21 | wb.right(1.0); |
jksoft | 0:37a76b1e82dc | 22 | wait (1.0); |
jksoft | 0:37a76b1e82dc | 23 | |
jksoft | 0:37a76b1e82dc | 24 | wb.stop(); |
jksoft | 0:37a76b1e82dc | 25 | |
jksoft | 0:37a76b1e82dc | 26 | while(1); |
jksoft | 0:37a76b1e82dc | 27 | |
jksoft | 0:37a76b1e82dc | 28 | } |