请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:TM4C123GE6PM 您好!
我有一个 IMU 传感器通过 I2C 向我的 TM4C Launchpad 发送数据。
这些值以浮点格式存储。
TM4C 是否具有可接受浮点参数并通过 UART 发送的本机函数?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
我有一个 IMU 传感器通过 I2C 向我的 TM4C Launchpad 发送数据。
这些值以浮点格式存储。
TM4C 是否具有可接受浮点参数并通过 UART 发送的本机函数?
我尝试使用以下代码:
int32_t i32IntegerPart = 0;
int32_t i32FractionPart = 0;
//获取新的加速计和陀螺仪读数。 MPU6050DataAccelGetFloat (&g_sMPU6050Inst、&fAccel[0]、&fAccel[1]、&fAccel[2]); MPU6050DataGyroGetFloat (&G) sMPU6050Inst、&fGyro[0]、&fGyro[1]、&fGyro[2]); // //将浮点环境温度转换为整数部分 //和分次器件,便于打印。 // i32IntegerPart =(int32_t) fAccel; i32FractionPart =(int32_t)(fAccel * 1000.0f);//此行中的错误 i32FractionPart = i32FractionPart -(i32IntegerPart * 1000); if (i32FractionPart < 0) { i32FractionPart *=-1; } UARTprintf ("环境%3d.%03d\t"、i32IntegerPart、i32FractionPart);
我收到一条错误消息、说:
#32表达式必须具有算术类型 main.c /PID 第189行 C/C++问题