pour simone

Dependencies:   MPU6050 mbed

Revision:
0:63c6db89607f
Child:
2:146ff0747375
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jun 03 13:51:01 2016 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+#include "mycontroller.h"
+#include "MPU6050.h"
+
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX); 
+Ticker filter; 
+Ticker toggler1; 
+MPU6050 mpu6050;  
+/*
+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() {
+    brushlessservo moteur;
+    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();
+    }
+}