添加ADC采集电压和RGB灯
This commit is contained in:
31
APP/mymain.c
31
APP/mymain.c
@ -9,35 +9,40 @@ void mymain()
|
||||
HAL_UART_Receive_IT(&huart1, (uint8_t *)g_rx_buffer, RXBUFFERSIZE); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
HAL_Delay(2000);
|
||||
led_init();
|
||||
adc_init();
|
||||
tle5012b_init();
|
||||
Init_ICM42688();
|
||||
imu_rest();
|
||||
// Init_ICM42688();
|
||||
// imu_rest();
|
||||
moto_Init();
|
||||
PID_Iint();
|
||||
setvbuf(stdout, NULL, _IONBF, 0); //<2F><><EFBFBD><EFBFBD>printfû<66><C3BB>\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
float x = 0,y=0;
|
||||
unsigned int i =0;
|
||||
HAL_TIM_Base_Start(&htim5); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// while(i<3300*3)
|
||||
// while(i<2000*1)
|
||||
// {
|
||||
// Angel_closed_loop(motorx,&FOCStruct_X,-0.2);
|
||||
// Angel_closed_loop(motory,&FOCStruct_Y,2.3);
|
||||
//// MpuGetData();
|
||||
//// GetAngle(&ICM42688,&Angle);
|
||||
// Angel_closed_loop(motorx,&FOCStruct_X,3.0);
|
||||
// Angel_closed_loop(motory,&FOCStruct_Y,2.2);
|
||||
// i++;
|
||||
// }
|
||||
// i=0;
|
||||
LED_ON;
|
||||
// LED_ON;
|
||||
while(1)
|
||||
{
|
||||
MpuGetData();
|
||||
GetAngle(&ICM42688,&Angle);
|
||||
x = Angle.pitch;
|
||||
y = Angle.roll ;
|
||||
Zitai_closed_loop(motorx,&FOCStruct_X,x);
|
||||
Zitai_closed_loop(motory,&FOCStruct_Y,-y);
|
||||
commander_run();
|
||||
// MpuGetData();
|
||||
// GetAngle(&ICM42688,&Angle);
|
||||
// x = Angle.pitch;
|
||||
// y = Angle.roll;
|
||||
// Zitai_closed_loop(motorx,&FOCStruct_X,x);
|
||||
// Zitai_closed_loop(motory,&FOCStruct_Y,-y);
|
||||
// commander_run();
|
||||
// x = getAngle(motorx);
|
||||
// y = getAngle(motory);
|
||||
// x= get_VCC();
|
||||
// printf("%fY%f\n",x,y);
|
||||
// HAL_Delay(2);
|
||||
// speed_closed_loop(motorx,&FOCStruct_X,_2PI*5);
|
||||
// speed_closed_loop(motory,&FOCStruct_Y,_2PI*2);
|
||||
// printf("b%d\n",b);
|
||||
|
Reference in New Issue
Block a user