Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Boboobooov4 by
Diff: main.cpp
- Revision:
- 13:63f9a5101205
- Parent:
- 12:fdada4af384a
- Child:
- 14:2d90b0066fc6
--- a/main.cpp Sat Jun 28 06:33:28 2014 +0000 +++ b/main.cpp Sat Jun 28 08:37:06 2014 +0000 @@ -25,7 +25,7 @@ BX_servo servo; -BX_camera cam; +BX_camera cam(79); BX_motor MotorA('A'); BX_motor MotorB('B'); @@ -97,18 +97,18 @@ stdio_mutex.lock(); #ifdef Debug_cam_uart #ifdef L_eye - pc.printf("L: "); - for(int i=0;i<128;i++){ + pc.printf("R: "); + for(int i=128;i>=0;i--){ if(i==64) pc.printf("X"); else if(i<10) pc.printf("-"); else if(i>117) - pc.printf("-"); - + pc.printf("-"); else - pc.printf("%c", cam.sign_line_imageL[i]); + pc.printf("%c", cam.sign_line_imageL[i]); } + pc.printf(" || "); #endif #ifdef R_eye @@ -125,7 +125,7 @@ } pc.printf("\r\n"); #endif - pc.printf("L: %d mid: %d R: %d\r\n",line3[0],line3[1],line3[2]); + pc.printf("L: %d mid: %d R: %d center : %d \r\n",line3[0],line3[1],line3[2],(line3[0]+line3[2])/2 ); stdio_mutex.unlock(); @@ -153,8 +153,11 @@ v_servo=cam_to_M_ctrlr.compute(ctrl,118.0); + + // pc.printf("angle: %f\r\n",v_servo); + stdio_mutex.lock(); servo.set_angle(v_servo); - + stdio_mutex.unlock(); Thread::wait(20); } @@ -178,7 +181,7 @@ } - +/* void ctrl_thread(void const *args){ @@ -196,7 +199,7 @@ } - +*/ // global resource @@ -221,7 +224,7 @@ */ Thread th_c(cam_thread); // Thread thread(ctrl_thread); - // Thread thread(servo_thread); + Thread thread(servo_thread); // Thread thread(motor_thread); Thread th_de(de_thread); while(1){