7Robot_Freescale / Mbed 2 deprecated freescal_cup_k22f

Dependencies:   mbed freescal_cup_k22f

Dependents:   freescal_cup_k22f

Committer:
RobinN7
Date:
Tue Jan 27 11:53:40 2015 +0000
Revision:
29:e7f37f801c93
Parent:
28:c9d882501013
commit myst?re

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RobinN7 0:3af30bfbc3e5 1
RobinN7 0:3af30bfbc3e5 2 //Bibliothéque
RobinN7 0:3af30bfbc3e5 3 #include "mbed.h"
RobinN7 0:3af30bfbc3e5 4 #include "QEI.h"
RobinN7 0:3af30bfbc3e5 5 #include "Gestion_Moteur.h"
RobinN7 0:3af30bfbc3e5 6 #include "Camera.h"
RobinN7 0:3af30bfbc3e5 7 #include "Servo.h"
RobinN7 0:3af30bfbc3e5 8
RobinN7 29:e7f37f801c93 9 #define debug_uart 1
RobinN7 27:d1da489fc79a 10
RobinN7 0:3af30bfbc3e5 11 //Differents objet/variable global
RobinN7 0:3af30bfbc3e5 12
RobinN7 27:d1da489fc79a 13 //Xbee
RobinN7 27:d1da489fc79a 14 Serial uart(PTD3, PTD2);
RobinN7 27:d1da489fc79a 15
AlexandreN7 1:49100fa5e278 16 //test de commit
RobinN7 14:000be67805b2 17 //Serial uart(USBTX, USBRX); //port série usb ACM0
RobinN7 26:a836e62e0c98 18
RobinN7 29:e7f37f801c93 19
RobinN7 0:3af30bfbc3e5 20
RobinN7 0:3af30bfbc3e5 21 int main() {
RobinN7 0:3af30bfbc3e5 22 // Initialisation
RobinN7 29:e7f37f801c93 23 wait(2);
RobinN7 26:a836e62e0c98 24 //float Kp_servo = 0;
RobinN7 0:3af30bfbc3e5 25 init_led();
RobinN7 26:a836e62e0c98 26 init_camera();
RobinN7 0:3af30bfbc3e5 27
RobinN7 27:d1da489fc79a 28 int compteur_uart=0;
RobinN7 27:d1da489fc79a 29
RobinN7 0:3af30bfbc3e5 30 // Init UART baudrate
RobinN7 27:d1da489fc79a 31 uart.baud(115200);
RobinN7 29:e7f37f801c93 32
RobinN7 0:3af30bfbc3e5 33
RobinN7 0:3af30bfbc3e5 34 // Lancement boucle
RobinN7 0:3af30bfbc3e5 35 while(1){
RobinN7 26:a836e62e0c98 36
RobinN7 29:e7f37f801c93 37 /***************** DEBUG UART *********************/
RobinN7 29:e7f37f801c93 38 if(debug_uart == 1) {
RobinN7 29:e7f37f801c93 39 if (flag_new_image==1)
RobinN7 29:e7f37f801c93 40 {
RobinN7 29:e7f37f801c93 41 // uart.printf("0,%d,%d\n\r",max_detect1,max_detect2);
RobinN7 29:e7f37f801c93 42 if (compteur_uart ==20) // on envoit une trame toute les 50 acquisitions de cameras
RobinN7 29:e7f37f801c93 43 {
RobinN7 29:e7f37f801c93 44 uart.printf("S3");//debug START
RobinN7 29:e7f37f801c93 45 uart.printf("%d,%d,%d,%lf,",max_detect1,max_detect2,0,ordre_servo);
RobinN7 29:e7f37f801c93 46 uart.printf("E");//debug END
RobinN7 29:e7f37f801c93 47 uart.printf("S1");//debug START
RobinN7 29:e7f37f801c93 48 for (int indice_pixel=0; indice_pixel<128; indice_pixel++)
RobinN7 29:e7f37f801c93 49 {
RobinN7 29:e7f37f801c93 50 uart.printf("%f,",pixel1[indice_pixel]);
RobinN7 29:e7f37f801c93 51 }
RobinN7 29:e7f37f801c93 52 uart.printf("E");//debug END
RobinN7 29:e7f37f801c93 53
RobinN7 29:e7f37f801c93 54 uart.printf("S2");//debug START
RobinN7 29:e7f37f801c93 55 for (int indice_pixel=0; indice_pixel<128; indice_pixel++)
RobinN7 29:e7f37f801c93 56 {
RobinN7 29:e7f37f801c93 57 uart.printf("%f,",pixel2[indice_pixel]);
RobinN7 29:e7f37f801c93 58 }
RobinN7 29:e7f37f801c93 59 uart.printf("E");//debug END
RobinN7 29:e7f37f801c93 60 compteur_uart =0;
RobinN7 26:a836e62e0c98 61 }
RobinN7 29:e7f37f801c93 62 else
RobinN7 26:a836e62e0c98 63 {
RobinN7 29:e7f37f801c93 64 compteur_uart =compteur_uart+1;
RobinN7 26:a836e62e0c98 65 }
AlexandreN7 20:24ebe046ebe9 66 }
RobinN7 29:e7f37f801c93 67 flag_new_image=0;
AlexandreN7 20:24ebe046ebe9 68 }
RobinN7 29:e7f37f801c93 69
RobinN7 29:e7f37f801c93 70 /***************** Code Main ici *********************/
RobinN7 29:e7f37f801c93 71
RobinN7 27:d1da489fc79a 72
RobinN7 0:3af30bfbc3e5 73 }
RobinN7 0:3af30bfbc3e5 74 }
RobinN7 0:3af30bfbc3e5 75