Hello,
I have an IMU sensor sending data via I2C to my TM4C Launchpad.
The values are stored in a floating point format.
Is there a native function for the TM4C that can accept a floating point argument and send it via 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.
Hello,
I have an IMU sensor sending data via I2C to my TM4C Launchpad.
The values are stored in a floating point format.
Is there a native function for the TM4C that can accept a floating point argument and send it via UART ?
I tried to use the code as follows:
int32_t i32IntegerPart = 0 ;
int32_t i32FractionPart = 0 ;
// Get the new accelerometer and gyroscope readings. MPU6050DataAccelGetFloat(&g_sMPU6050Inst, &fAccel[0], &fAccel[1], &fAccel[2]); MPU6050DataGyroGetFloat(&g_sMPU6050Inst, &fGyro[0], &fGyro[1], &fGyro[2]); // // Convert the floating point ambient temperature to an integer part // and fraction part for easy printing. // i32IntegerPart = (int32_t)fAccel; i32FractionPart = (int32_t)(fAccel * 1000.0f); // Error in this line i32FractionPart = i32FractionPart - (i32IntegerPart * 1000); if(i32FractionPart < 0) { i32FractionPart *= -1; } UARTprintf("Ambient %3d.%03d\t", i32IntegerPart, i32FractionPart);
I get an error on the saying:
#32 expression must have arithmetic type main.c /PID line 189 C/C++ Problem