svoe

Dependencies:   mbed mbed-STM32F103C8T6 MPU6050_1

main.cpp

Committer:
Stas285
Date:
2018-12-01
Revision:
15:960b922433d1
Parent:
13:789b451cc27d
Child:
17:bd6b6ac89e0e
Child:
18:af32a5e7e8ae

File content as of revision 15:960b922433d1:

#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;
    wait_ms(500);
    system_init();
    start_recognizer();
    play(1);
    
    while(1){
        while(realtime_flag == 0){}
        myled = 0; //inverse connection
        gyro.read(&gx,&gy,&gz,&ax,&ay,&az); //doesn't work in interrupt // reading - 500 uS 
//constant speed motion: distance_to_target = (x_diff/x_prop) * target.speed
        balance_coord(); 
        //balance_motion();   
        if(external_command != 0) command_process();
        voice_command_process();
        if (k++ > 1000) {k = 0;} else { target.x = trajectory[int(k/100)][0];target.y = trajectory[int(k/100)][1]; target.azimuth = trajectory[int(k/100)][2];}
        realtime_flag = 0; myled = 1;
        }
    //while(1){proc_counter++;}
}