123

Dependencies:   mbed

Fork of Boboobooo by Clark Lin

Committer:
physicsgood
Date:
Mon Jul 07 08:16:46 2014 +0000
Revision:
6:b046d6ff3745
Parent:
3:c5f2281b3ed2
Child:
7:f04bde0ca846
QQQQQQQ

Who changed what in which revision?

UserRevisionLine numberNew 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
physicsgood 6:b046d6ff3745 5 #include "motor_api.h"
backman 3:c5f2281b3ed2 6 #define Debug_cam_uart
backman 0:68c173249c01 7
physicsgood 6:b046d6ff3745 8 //middle 0.041
backman 1:82bc25a7b68b 9 Serial pc(USBTX, USBRX);
backman 1:82bc25a7b68b 10 BX_servo servo;
physicsgood 6:b046d6ff3745 11 BX_camera cam;
physicsgood 6:b046d6ff3745 12 BX_motor MotorA('A');
physicsgood 6:b046d6ff3745 13 BX_motor MotorB('B');
backman 0:68c173249c01 14
backman 3:c5f2281b3ed2 15
backman 3:c5f2281b3ed2 16
backman 0:68c173249c01 17 int main() {
backman 0:68c173249c01 18
backman 1:82bc25a7b68b 19 /*
backman 1:82bc25a7b68b 20 int black_va;
backman 1:82bc25a7b68b 21 int white_va;
backman 1:82bc25a7b68b 22 */
physicsgood 6:b046d6ff3745 23 double Kp = 0.0;
backman 1:82bc25a7b68b 24
backman 3:c5f2281b3ed2 25 #ifdef Debug_cam_uart
backman 1:82bc25a7b68b 26 pc.baud(115200);
backman 1:82bc25a7b68b 27
backman 1:82bc25a7b68b 28
backman 3:c5f2281b3ed2 29 while(1){
backman 1:82bc25a7b68b 30
physicsgood 6:b046d6ff3745 31 cam.read();
physicsgood 6:b046d6ff3745 32 MotorA.rotate(0.0);
physicsgood 6:b046d6ff3745 33 MotorB.rotate(0.0);
physicsgood 6:b046d6ff3745 34 servo.set_angle(0.051);
physicsgood 6:b046d6ff3745 35 /*for(int i=0;i<128;i++){
backman 1:82bc25a7b68b 36 if(i==64)
backman 1:82bc25a7b68b 37 pc.printf("X");
backman 1:82bc25a7b68b 38 else
backman 2:c51647d3c14d 39 pc.printf("%c", cam.sign_line_imageL[i]);
backman 2:c51647d3c14d 40 }
backman 2:c51647d3c14d 41 pc.printf(" || ");
backman 2:c51647d3c14d 42
backman 2:c51647d3c14d 43 for(int i=0;i<128;i++){
backman 2:c51647d3c14d 44 if(i==64)
backman 2:c51647d3c14d 45 pc.printf("X");
backman 2:c51647d3c14d 46 else
backman 2:c51647d3c14d 47 pc.printf("%c", cam.sign_line_imageR[i]);
backman 1:82bc25a7b68b 48 }
physicsgood 6:b046d6ff3745 49 pc.printf("\r\n");*/
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 // pc.printf("ang :%d\r\n ",( (64.0-center) /64.0 )*90);
backman 1:82bc25a7b68b 60 //--------------------------------------------
backman 2:c51647d3c14d 61
backman 2:c51647d3c14d 62
backman 3:c5f2281b3ed2 63 // servo.set_angle(( (64.0-center) /64.0 )*90 );
backman 2:c51647d3c14d 64
backman 3:c5f2281b3ed2 65
backman 1:82bc25a7b68b 66
backman 3:c5f2281b3ed2 67
backman 1:82bc25a7b68b 68
backman 1:82bc25a7b68b 69
backman 3:c5f2281b3ed2 70 #endif
backman 1:82bc25a7b68b 71
backman 1:82bc25a7b68b 72
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 0:68c173249c01 84
backman 0:68c173249c01 85
backman 0:68c173249c01 86
backman 1:82bc25a7b68b 87 return 0;
backman 0:68c173249c01 88
backman 0:68c173249c01 89
backman 0:68c173249c01 90 }