svoe

Dependencies:   mbed mbed-STM32F103C8T6 MPU6050_1

main.cpp

Committer:
dima285
Date:
2018-11-11
Revision:
13:789b451cc27d
Parent:
12:721a9ea55e91
Child:
15:960b922433d1

File content as of revision 13:789b451cc27d:

#include "stm32f103c8t6.h"
#include "mbed.h"
#include "common.h"
#include "gyro.h"
#include "motor.h"
#include "serva.h"
#include "echo.h"
#include "motion.h"
#include "wifi.h"
#include "realtime.h"
#include "system.h"
#include "sound.h"



int main() {
    int k = 0;
    wait_ms(1000);
    system_init();
    //gyro_x=0, gyro_y=0, gyro_angle=0, gyro_v=0, gyro_s=0;
    current.x = 0;
    
    while(1){
        while(realtime_flag == 0){}
        gyro.read(&gx,&gy,&gz,&ax,&ay,&az); //doesn't work in interrupt // reading - 500 uS 
        balance();    
        if(external_command != 0) command_process();
        realtime_flag = 0;
        k++;
        //target.x = 0;
        //target.y = 0;
        if (k > 3596) { k = 0;  } else { target.x = trajectory[int(k/400)][1];target.y = trajectory[int(k/400)][0]; }
        //k++ ; target.x = 0.1*int(k/200);
        }
    //while(1){proc_counter++;}
}