Created
November 25, 2017 11:56
-
-
Save valentyn-zaitsev/e69cbab0ea3a606711d0d433929af70d to your computer and use it in GitHub Desktop.
Byte array to Float
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void byteArrayToFloat(uint16_t length){//длина массива (если значений несколько*) | |
union | |
{ | |
uint32_t j; | |
float f; | |
} u; | |
for (int i=0;i<length;i+=4){//* | |
u.j = array[i]<<24 | array[i+1]<<16 | array[i+2]<<8 | array[i+3]; | |
printf("%.2f\n", u.f); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment