wesh gros, ajout des ref dans brushlessservo

Dependencies:   MPU6050 mbed

Fork of Gimbal_ENSEA by Thomas Giraud-Sauveur

main.cpp

Committer:
sype
Date:
2016-06-03
Revision:
2:d0606d66af96
Parent:
0:63c6db89607f

File content as of revision 2:d0606d66af96:

#include "mbed.h"
#include "mycontroller.h"
#include "MPU6050.h"

DigitalOut myled(LED1);
Serial pc(USBTX, USBRX); 
Ticker filter; 
Ticker toggler1; 
MPU6050 mpu6050;

PwmOut pwmA1(PA_1);
PwmOut pwmA2(PA_2);
PwmOut pwmA3(PA_3);

PwmOut pwmB1(PA_4);
PwmOut pwmB2(PA_5);
PwmOut pwmB3(PA_6);

brushlessservo moteur(pwmA1,pwmA2,pwmA3);
brushlessservo moteurB(pwmB1,pwmB2,pwmB3);

/*
PwmOut pwm1A(PA_10);
PwmOut pwm1B(PA_6);
PwmOut pwm1C(PB_6);
DigitalOut enable1A(PA_7);
DigitalOut enable1B(PA_9);
*/
float pitchAngle = 0;
float rollAngle = 0;

void compFilter() {mpu6050.complementaryFilter(&pitchAngle, &rollAngle);}
void toggle_led1() {myled!=myled;}
void toggle_led2();

int main() {
    mpu6050.init(); 
    filter.attach(&compFilter, 0.005);
    wait(1);
    /*
    moteur.gotothetha(450);
    wait(1);
    moteur.gotothetha(0);
    wait(1);
    moteur.gotothetha(1350);
    moteur.gotothetha(0);
    
    for(int i=0; i<1800;i+=5){
        moteur.gotothetha(i);
        wait_ms(100);
    }
    */
//    int32_t angle = 0;
    
    while(1) {
        //printf("%f\n",pitchAngle);
        moteur.gotothetha( ((int)pitchAngle)*10 );
        //moteur.test();
    }
}