Testing of reflection sensor query
Dependencies: Test_motor mbed
main.cpp@0:fb7117213e54, 2014-05-20 (annotated)
- Committer:
- bayagich
- Date:
- Tue May 20 13:12:44 2014 +0000
- Revision:
- 0:fb7117213e54
Test for Motor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bayagich | 0:fb7117213e54 | 1 | #include "mbed.h" |
bayagich | 0:fb7117213e54 | 2 | #include "m3pi_ng.h" |
bayagich | 0:fb7117213e54 | 3 | |
bayagich | 0:fb7117213e54 | 4 | DigitalOut myled(LED1); |
bayagich | 0:fb7117213e54 | 5 | |
bayagich | 0:fb7117213e54 | 6 | m3pi george; |
bayagich | 0:fb7117213e54 | 7 | |
bayagich | 0:fb7117213e54 | 8 | int main() { |
bayagich | 0:fb7117213e54 | 9 | |
bayagich | 0:fb7117213e54 | 10 | //MOTOR TEST |
bayagich | 0:fb7117213e54 | 11 | |
bayagich | 0:fb7117213e54 | 12 | //left motor test |
bayagich | 0:fb7117213e54 | 13 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 14 | george.left_motor(0.3); |
bayagich | 0:fb7117213e54 | 15 | } |
bayagich | 0:fb7117213e54 | 16 | george.stop(); |
bayagich | 0:fb7117213e54 | 17 | wait(3); |
bayagich | 0:fb7117213e54 | 18 | |
bayagich | 0:fb7117213e54 | 19 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 20 | george.left_motor(-0.3); |
bayagich | 0:fb7117213e54 | 21 | } |
bayagich | 0:fb7117213e54 | 22 | george.stop(); |
bayagich | 0:fb7117213e54 | 23 | wait(3); |
bayagich | 0:fb7117213e54 | 24 | |
bayagich | 0:fb7117213e54 | 25 | |
bayagich | 0:fb7117213e54 | 26 | //right motor test |
bayagich | 0:fb7117213e54 | 27 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 28 | george.right_motor(0.3); |
bayagich | 0:fb7117213e54 | 29 | } |
bayagich | 0:fb7117213e54 | 30 | george.stop(); |
bayagich | 0:fb7117213e54 | 31 | wait(3); |
bayagich | 0:fb7117213e54 | 32 | |
bayagich | 0:fb7117213e54 | 33 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 34 | george.right_motor(-0.3); |
bayagich | 0:fb7117213e54 | 35 | } |
bayagich | 0:fb7117213e54 | 36 | george.stop(); |
bayagich | 0:fb7117213e54 | 37 | wait(3); |
bayagich | 0:fb7117213e54 | 38 | //testing limits |
bayagich | 0:fb7117213e54 | 39 | |
bayagich | 0:fb7117213e54 | 40 | //left motor test |
bayagich | 0:fb7117213e54 | 41 | |
bayagich | 0:fb7117213e54 | 42 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 43 | george.left_motor(1); |
bayagich | 0:fb7117213e54 | 44 | } |
bayagich | 0:fb7117213e54 | 45 | george.stop(); |
bayagich | 0:fb7117213e54 | 46 | wait(3); |
bayagich | 0:fb7117213e54 | 47 | |
bayagich | 0:fb7117213e54 | 48 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 49 | george.left_motor(-1); |
bayagich | 0:fb7117213e54 | 50 | } |
bayagich | 0:fb7117213e54 | 51 | george.stop(); |
bayagich | 0:fb7117213e54 | 52 | wait(3); |
bayagich | 0:fb7117213e54 | 53 | |
bayagich | 0:fb7117213e54 | 54 | //right motor test |
bayagich | 0:fb7117213e54 | 55 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 56 | george.right_motor(1); |
bayagich | 0:fb7117213e54 | 57 | } |
bayagich | 0:fb7117213e54 | 58 | george.stop(); |
bayagich | 0:fb7117213e54 | 59 | wait(3); |
bayagich | 0:fb7117213e54 | 60 | |
bayagich | 0:fb7117213e54 | 61 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 62 | george.right_motor(-1); |
bayagich | 0:fb7117213e54 | 63 | } |
bayagich | 0:fb7117213e54 | 64 | george.stop(); |
bayagich | 0:fb7117213e54 | 65 | wait(3); |
bayagich | 0:fb7117213e54 | 66 | |
bayagich | 0:fb7117213e54 | 67 | for(int i = 0; i < 1000; ++i){ |
bayagich | 0:fb7117213e54 | 68 | george.right_motor(0); |
bayagich | 0:fb7117213e54 | 69 | } |
bayagich | 0:fb7117213e54 | 70 | george.stop(); |
bayagich | 0:fb7117213e54 | 71 | wait(3); |
bayagich | 0:fb7117213e54 | 72 | } |