EE149
/
FinalProject
Final Project files for mBed development.
Diff: main.c
- Revision:
- 24:b797563776fc
- Parent:
- 23:e4616259a7f0
- Child:
- 25:2c7717684d09
diff -r e4616259a7f0 -r b797563776fc main.c --- a/main.c Sun Dec 07 05:55:38 2014 +0000 +++ b/main.c Sun Dec 07 09:36:59 2014 +0000 @@ -56,7 +56,6 @@ // Basic setup information start_button.mode(PullUp); - start: pi.cls(); pi.locate(0,0); pi.printf("PiCO"); @@ -69,7 +68,7 @@ pi.locate(0,0); pi.printf("Ready"); oled_2 = 0; - } /**/ + } */ pi.cls(); pi.locate(0,0); // pi.printf("GO!"); @@ -84,11 +83,10 @@ goto calibrate; } } - /**/ + */ // // Drawing environment calibration. - int cal_count = 1; pi.sensor_auto_calibrate(); //pi.backward(DRIVE_SPEED); float pos = 0; @@ -126,7 +124,7 @@ goto calibrate; return 1; } - /**/ + */ // wait(1); @@ -211,7 +209,7 @@ pi.printf("p:%f", pos); pos = pi.line_position(); } while (pos != -1 && pos >= -0.25); - /**/ + */ backward(500); timerWait(.5); while(fabs(pos = pi.line_position()) > CLOSE_ENOUGH) { @@ -247,7 +245,7 @@ pos = pi.line_position(); timerWait(.2); } - /**/ + */ timerWait(1); // // Pivot 180 degrees to go to the starting position. @@ -281,7 +279,7 @@ pi.printf("lP:%f", pos); return 1; } - /**/ + */ /* while(pi.line_position() == 1); do { @@ -504,6 +502,9 @@ int right(float deg) { + if(deg < 0) { + return left(-1*deg); + } Timer t; oled_4 = 1; pi.locate(0,0); @@ -527,6 +528,9 @@ int left(float deg) { + if(deg < 0) { + return right(-1*deg); + } Timer t; oled_4 = 1; oled_2 = 1;