Dima Dudin / Mbed 2 deprecated DD_Robot

Dependencies:   mbed mbed-STM32F103C8T6 MPU6050_1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "stm32f103c8t6.h"
00002 #include "mbed.h"
00003 #include "VL53L1X.h"
00004 #include "common.h"
00005 #include "gyro.h"
00006 #include "motor.h"
00007 #include "serva.h"
00008 #include "echo.h"
00009 #include "motion.h"
00010 #include "wifi.h"
00011 #include "realtime.h"
00012 #include "system.h"
00013 #include "sound.h"
00014 
00015 
00016 
00017 int main() {
00018     //int k,l;
00019     wait_ms(500);
00020     system_init();
00021     start_recognizer();
00022     //play(1);
00023     delay_counter = 4;
00024     motion_flag = 0;
00025     motion_mode = STOP;
00026     serva(-90);
00027     serva_counter = 0;
00028     
00029     //wait(20);
00030    
00031     
00032     while(1){
00033         //myled = 1; //SMErT' !!!!!!! 
00034         while(realtime_flag == 0){}
00035         //myled = 0;
00036         //myled = 0; //inverse connection
00037         gyro.read(&gx,&gy,&gz,&ax,&ay,&az); //doesn't work in interrupt // reading - 500 uS 
00038         ax_filter();
00039 //constant speed motion: distance_to_target = (x_diff/x_prop) * target.speed
00040         if (fall_flag == 1) vstavai();
00041         //balance_coord(); 
00042         balance_motion_PID();    
00043         if(external_command != 0) command_process(); 
00044         if (echo_delay_counter++ > 2) {echo_delay_counter = 0; rt_scan();}      //echo every 3 csycles
00045         free_walk();//motion
00046         //motion_1D();
00047         
00048         //voice_command_process();
00049         //if (k++ > 200) {k = 0;/*play(rand()%10+1);*/} else { target.x = trajectory[int(k/100)][0];target.y = trajectory[int(k/100)][1]; target.azimuth = trajectory[int(k/100)][2];}
00050         //if (l++ > 25) {l = 0; wifi.printf("%u", glaz.read());}
00051         realtime_flag = 0;// myled = 1;
00052         }
00053     //while(1){proc_counter++;}
00054 }
00055