7Robot_Freescale / Mbed 2 deprecated freescal_cup_k22f

Dependencies:   mbed freescal_cup_k22f

Dependents:   freescal_cup_k22f

source/main.cpp

Committer:
AlexandreN7
Date:
2015-01-13
Revision:
8:8f886cd6a59f
Parent:
1:49100fa5e278
Child:
9:43c8e6d6724d

File content as of revision 8:8f886cd6a59f:


//Bibliothéque
#include "mbed.h"
#include "QEI.h"
#include "Gestion_Moteur.h"
#include "Camera.h"
#include "Servo.h"

//Differents objet/variable global

//test de commit

Serial uart(PTD3, PTD2);
Servo servo(PTD0);


int main() {
 // Initialisation
 
    int indexMin=0;   
    int indexMax=128;  
    int max_detect=indexMin;
    uart.baud(115200); 
    init_led();
   
    // Init UART baudrate

         
    // Lancement boucle
    while(1){
        
        readline();
        passebas();
        
        uart.printf("S");//debug START
        for (int indice_pixel=0; indice_pixel<128; indice_pixel++)   
        {
            uart.printf("%d,",pixel[indice_pixel]);
        }
        uart.printf("E");//debug END
        
        for (int j=indexMin; j<indexMax; j++)
        {
            if (pixel[j]>pixel[max_detect])
            {
                max_detect=j;
            }
        }
        
        //servo = float(min_detect-indexMin)/float(indexMax-indexMin);
        servo = float(max_detect)/128.;

    }
}