譯文 張
/
BX-car
good
Fork of BX-car by
Diff: main.cpp
- Revision:
- 2:c51647d3c14d
- Parent:
- 1:82bc25a7b68b
- Child:
- 3:c5f2281b3ed2
diff -r 82bc25a7b68b -r c51647d3c14d main.cpp --- a/main.cpp Tue Jun 03 15:53:55 2014 +0000 +++ b/main.cpp Wed Jun 04 12:56:52 2014 +0000 @@ -7,8 +7,7 @@ Serial pc(USBTX, USBRX); BX_servo servo; - BX_camera cam('n'); - PwmOut cam_clk(PTC3); + BX_camera cam; int main() { @@ -40,24 +39,33 @@ bool f4; while(1){ - + // cam.read(); for(int i=0;i<128;i++){ if(i==64) pc.printf("X"); else - pc.printf("%c", cam.sign_line_image[i]); + pc.printf("%c", cam.sign_line_imageL[i]); + } + pc.printf(" || "); + + for(int i=0;i<128;i++){ + if(i==64) + pc.printf("X"); + else + pc.printf("%c", cam.sign_line_imageR[i]); } pc.printf("\r\n"); + // find center // case 1 // | // //case 2 / | / - + /* if(cam.sign_line_image[64]==' ') find_type=0x02; else @@ -172,11 +180,13 @@ break; } - pc.printf("center :%d\r\n",center); + pc.printf("ang :%d\r\n ",( (64.0-center) /64.0 )*90); //-------------------------------------------- - - - + + + servo.set_angle(( (64.0-center) /64.0 )*90 ); + + */ } @@ -222,9 +232,9 @@ // angle+=cam.line_image[i]-cam.line_image[127-i]; - if(cam.line_image[i]==0) + if(cam.line_imageR[i]==0) black_pR++; - if(cam.line_image[127-i]==0) + if(cam.line_imageR[127-i]==0) black_pL++; }