譯文 張
/
7_7Boboobooo
123
Fork of Boboobooo by
main.cpp@3:c5f2281b3ed2, 2014-06-04 (annotated)
- Committer:
- backman
- Date:
- Wed Jun 04 14:41:28 2014 +0000
- Revision:
- 3:c5f2281b3ed2
- Parent:
- 2:c51647d3c14d
- Child:
- 6:b046d6ff3745
center;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
backman | 0:68c173249c01 | 1 | #include "mbed.h" |
backman | 1:82bc25a7b68b | 2 | #include "servo_api.h" |
backman | 1:82bc25a7b68b | 3 | #include "camera_api.h" |
backman | 3:c5f2281b3ed2 | 4 | |
backman | 3:c5f2281b3ed2 | 5 | |
backman | 3:c5f2281b3ed2 | 6 | #define Debug_cam_uart |
backman | 0:68c173249c01 | 7 | |
backman | 0:68c173249c01 | 8 | |
backman | 1:82bc25a7b68b | 9 | Serial pc(USBTX, USBRX); |
backman | 1:82bc25a7b68b | 10 | BX_servo servo; |
backman | 1:82bc25a7b68b | 11 | |
backman | 2:c51647d3c14d | 12 | BX_camera cam; |
backman | 0:68c173249c01 | 13 | |
backman | 3:c5f2281b3ed2 | 14 | |
backman | 3:c5f2281b3ed2 | 15 | |
backman | 0:68c173249c01 | 16 | int main() { |
backman | 0:68c173249c01 | 17 | |
backman | 1:82bc25a7b68b | 18 | /* |
backman | 1:82bc25a7b68b | 19 | int black_va; |
backman | 1:82bc25a7b68b | 20 | int white_va; |
backman | 1:82bc25a7b68b | 21 | */ |
backman | 1:82bc25a7b68b | 22 | |
backman | 3:c5f2281b3ed2 | 23 | #ifdef Debug_cam_uart |
backman | 1:82bc25a7b68b | 24 | pc.baud(115200); |
backman | 1:82bc25a7b68b | 25 | |
backman | 1:82bc25a7b68b | 26 | |
backman | 3:c5f2281b3ed2 | 27 | while(1){ |
backman | 1:82bc25a7b68b | 28 | |
backman | 3:c5f2281b3ed2 | 29 | cam.read(); |
backman | 1:82bc25a7b68b | 30 | |
backman | 1:82bc25a7b68b | 31 | for(int i=0;i<128;i++){ |
backman | 1:82bc25a7b68b | 32 | if(i==64) |
backman | 1:82bc25a7b68b | 33 | pc.printf("X"); |
backman | 1:82bc25a7b68b | 34 | else |
backman | 2:c51647d3c14d | 35 | pc.printf("%c", cam.sign_line_imageL[i]); |
backman | 2:c51647d3c14d | 36 | } |
backman | 2:c51647d3c14d | 37 | pc.printf(" || "); |
backman | 2:c51647d3c14d | 38 | |
backman | 2:c51647d3c14d | 39 | for(int i=0;i<128;i++){ |
backman | 2:c51647d3c14d | 40 | if(i==64) |
backman | 2:c51647d3c14d | 41 | pc.printf("X"); |
backman | 2:c51647d3c14d | 42 | else |
backman | 2:c51647d3c14d | 43 | pc.printf("%c", cam.sign_line_imageR[i]); |
backman | 1:82bc25a7b68b | 44 | } |
backman | 1:82bc25a7b68b | 45 | pc.printf("\r\n"); |
backman | 3:c5f2281b3ed2 | 46 | |
backman | 3:c5f2281b3ed2 | 47 | |
backman | 3:c5f2281b3ed2 | 48 | |
backman | 3:c5f2281b3ed2 | 49 | pc.printf("R center : %d \r\nL center: %d\r\n",cam.black_centerR(),cam.black_centerL()); |
backman | 3:c5f2281b3ed2 | 50 | |
backman | 3:c5f2281b3ed2 | 51 | |
backman | 3:c5f2281b3ed2 | 52 | } |
backman | 3:c5f2281b3ed2 | 53 | |
backman | 3:c5f2281b3ed2 | 54 | |
backman | 3:c5f2281b3ed2 | 55 | |
backman | 3:c5f2281b3ed2 | 56 | |
backman | 3:c5f2281b3ed2 | 57 | |
backman | 3:c5f2281b3ed2 | 58 | |
backman | 3:c5f2281b3ed2 | 59 | |
backman | 3:c5f2281b3ed2 | 60 | |
backman | 3:c5f2281b3ed2 | 61 | // pc.printf("ang :%d\r\n ",( (64.0-center) /64.0 )*90); |
backman | 1:82bc25a7b68b | 62 | //-------------------------------------------- |
backman | 2:c51647d3c14d | 63 | |
backman | 2:c51647d3c14d | 64 | |
backman | 3:c5f2281b3ed2 | 65 | // servo.set_angle(( (64.0-center) /64.0 )*90 ); |
backman | 2:c51647d3c14d | 66 | |
backman | 3:c5f2281b3ed2 | 67 | |
backman | 1:82bc25a7b68b | 68 | |
backman | 3:c5f2281b3ed2 | 69 | |
backman | 1:82bc25a7b68b | 70 | |
backman | 1:82bc25a7b68b | 71 | |
backman | 3:c5f2281b3ed2 | 72 | #endif |
backman | 1:82bc25a7b68b | 73 | |
backman | 1:82bc25a7b68b | 74 | |
backman | 1:82bc25a7b68b | 75 | |
backman | 1:82bc25a7b68b | 76 | |
backman | 1:82bc25a7b68b | 77 | |
backman | 1:82bc25a7b68b | 78 | |
backman | 1:82bc25a7b68b | 79 | |
backman | 1:82bc25a7b68b | 80 | |
backman | 1:82bc25a7b68b | 81 | |
backman | 1:82bc25a7b68b | 82 | |
backman | 1:82bc25a7b68b | 83 | |
backman | 1:82bc25a7b68b | 84 | |
backman | 1:82bc25a7b68b | 85 | |
backman | 0:68c173249c01 | 86 | |
backman | 0:68c173249c01 | 87 | |
backman | 0:68c173249c01 | 88 | |
backman | 1:82bc25a7b68b | 89 | return 0; |
backman | 0:68c173249c01 | 90 | |
backman | 0:68c173249c01 | 91 | |
backman | 0:68c173249c01 | 92 | } |