Hello,
I was using ESP-12S module to read a dust sensor and got it to work.
The data comes in four bytes which I convert to float like this:
float PM1_0u_float = *( (float*) PM1_0u );
The result is typically around 6, like 6.23.
When I switched to ESP8266MOD (AI-thinker) I was surprised that the same code doesn't work anymore. With this board the results are around 12000, like 12120.87.
I also tries to do the conversion using union, but still the same problem.
union TEMP {
float f;
byte b[4];
};
TEMP temp;
for (int cnt = 0; cnt < 4; cnt++) {
tempor.b[cnt] = PM1_0u[3 - cnt];
}
PM1_0u_float = tempor.f;
What is going on here?
How can I fix it to work with ESP8266MOD also?
Thanks,
Tipo