How to convert uin8_t data type to float?

Hi kindly guide me How to convert uin8_t data type to float ?
uint8_t a = 20;
float b =a;
this method is not working kindly me about it

Your method should work...

What makes you think it does not work?

1 Like

what's not working?

why do you think you need to explicitly cast it to float? float can hold uint8_t easily

1 Like

was a mistake. post deleted.

its not working showing wrong values

i am using sensor which gives precise value in float becoz i need to fetch data in ponters and array

uint8_t a = 20;
float b =a;

Oh look you can copy paste your own posts! Cool, good luck with your thread

If the sensor already gives you the value as a float, what is the requirement for converting a value into a float?

sensor just gives the hexa values

Hello AliGul1234567890
Post your sketch, well formated, with comments and in so called code tags "</>" and a none-Fritzing schematic to see how we can help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.