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