Object Avoidance Program
Dependencies: 4DGL-uLCD-SE Motordriver mbed
Diff: main.cpp
- Revision:
- 3:8af20d0242b2
- Parent:
- 2:d38a5f767527
- Child:
- 4:1c83cabcd6f8
--- a/main.cpp Tue Apr 29 21:27:10 2014 +0000 +++ b/main.cpp Tue Apr 29 22:06:35 2014 +0000 @@ -50,22 +50,33 @@ // pc.printf("Right Sensor is: %f \n", rightsensor); // if((frontsensor > 52)&&(frontsensor < 100)){ - mA.stop(0.5); - mB.stop(0.5); - mA.speed(-.6); - mB.speed(-.8); - led_front = 1; - led_back = 0; - led_left = 0; - led_right = 0; - mA.stop(0.5); - mB.stop(0.5); - } - else if((backsensor > 52)&&(backsensor < 100)){ + //mA.stop(0.5); + // mB.stop(0.5); + //mA.speed(-.6); + //mB.speed(-.8); + //led_front = 1; + // led_back = 0; + // led_left = 0; + // led_right = 0; + // mA.stop(0.5); + //mB.stop(0.5); + led_front = 1; + } + else {led_front= 0;} + + if((backsensor > 52)&&(backsensor < 100)){ led_back = 1;} - else if((leftsensor > 52)&&(leftsensor < 100)){ + else {led_back = 0;} + + if((leftsensor > 52)&&(leftsensor < 100)){ led_left = 1;} - else if((rightsensor > 52)&&(rightsensor < 100)){ + else {led_left = 0;} + + if((rightsensor > 52)&&(rightsensor < 100)){ led_right = 1;} + else {led_right = 0;} + + + } } \ No newline at end of file