compiling main.c...
..\User\main.c(43): error: #20: identifier "x_temp" is undefined
a=x_temp;
..\User\main.c(44): error: #20: identifier "y_temp" is undefined
b=y_temp;
..\User\main.c(45): error: #20: identifier "z_temp" is undefined
c=z_temp;
最近在弄mpu6050一直这个错误,知道是没定义 。但是怎么改还是改不过来。
下面是主函数的代码
[mw_shl_code=c,true]#include "main.h"
#include "stdio.h"
//????·??ò???????????¨????????????????????????????±???
//?????÷???????????í
//extern unsigned int Task_Delay[NumOfTask];
//unsigned int Task_Delay[NumOfTask]={0};
//#define NumOfTask 2
//#define TASK_ENABLE 0
//unsigned int Task_Delay[NumOfTask];
u8 a,b,c;
int main(void)
{
// short Gyro[3];
LED_Configuration();
USART1_Configuration();
IIC_GPIO_Init();
MPU6050_Initialization();
{
int i = 0;
//delay 500ms?? ????mpu6050???????¨
delay_ms(500);
while(MPU6050_Initialization() == 0xff)
{
i++; //????????????????????????????????????
if(i>10) //?????????????±???????????????????????????????·??·??ù?÷???±??
{
while(1)
{
LED1_TOGGLE();
delay_ms(50);
}
}
else
{
delay_ms(50);
while(1)
{
MPU6050_Gyro_calibration();
MPU6050_Interrupt_Configuration();
a=x_temp;
b=y_temp;
c=z_temp;
delay_ms(100);
printf("???????? %8d%8d%8d ",a,b,c);
}
}
}
} [/mw_shl_code]
下面是mpu6050程序
[mw_shl_code=c,true]void MPU6050_Gyro_calibration(void)
{
u16 i;
float x_temp=0,y_temp=0,z_temp=0;
for(i=0; i<1000; i++)
{
MPU6050_ReadData();
delay_ms(1);
x_temp=x_temp+MPU6050_Raw_Data.Gyro_X;
y_temp=y_temp+MPU6050_Raw_Data.Gyro_Y;
z_temp=z_temp+MPU6050_Raw_Data.Gyro_Z;
}
x_temp=x_temp/1000.00;
y_temp=y_temp/1000.00;
z_temp=z_temp/1000.00;
gyroADC_X_offset=(int)x_temp;
gyroADC_Y_offset=(int)y_temp;
gyroADC_Z_offset=(int)z_temp;[/mw_shl_code]
求大神指教
|