svoe
Dependencies: mbed mbed-STM32F103C8T6 MPU6050_1
main.cpp
- Committer:
- dima285
- Date:
- 2017-09-16
- Revision:
- 9:8f98b1c277a4
- Parent:
- 8:891e4f54e9e2
- Child:
- 10:5bdd3dfd5f59
File content as of revision 9:8f98b1c277a4:
#include "stm32f103c8t6.h" #include "mbed.h" //#include "USBSerial.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() { system_init(); // usb_serial.printf("I am a USB serial port\r\n"); //stop(); gyro_x=0, gyro_y=0, gyro_angle=0, gyro_v=0, gyro_s=0; play(21); /*go(1); stop();*/ speed = 10;radius = 1e5; infinite_flag = 1;motor_busy = 1;stop_flag = 0; //go(5); //external_command = 0xff; /* MPU6050 gyro(PB_9,PB_8); pc.printf("%hu ::",gyro.getID()); pc.printf("%hu ::",gyro.getID()); pc.printf("%hu ::",gyro.getID()); pc.printf("%hu ::",gyro.getID()); I2C i2c(PB_9,PB_8); i2c.frequency(400000); int tmaddr = 0xD1; char tmdata = 117; pc.printf("%hhu, ",i2c.write(tmaddr, &tmdata,1)); pc.printf("%hhu, ",i2c.write(tmaddr, &tmdata,1)); pc.printf("%hhu: ",i2c.read(tmaddr,&tmdata,1)); pc.printf("%hhu; \n",tmdata); */ while(1){ //pc.printf("mhgc"); while(realtime_flag == 0){} if(external_command != 0) command_process(); //wait_ms(40); //blocking gy_old = gy; gyro_process(); //doesn't work in interrupt //pc.printf("ax:%.2f",ax); //if (infinite_flag == 1) wifi.printf("%.4f %.2f %.2f; ",ax,gz,motor_speed[1]); //wifi.printf("%.4f %.2f %.2f ",ax,ax,ax); realtime_flag = 0; } //while(1){proc_counter++;} // dance(10,5); } //check_battery;