I believe it’s because of the format you’re using in the print statement. Can you try to use %lf instead of %2f?
Let us know if this works for you.
the effect of below code:
double a = 2.345;
QM_PRINTF("VCC: %lf \n", a);
so maybe you have other idea ?
Of course it is not the problem resolve this situation (for example code below) but I just wondering maybe it it possible to write shorter code and base it on double type of data:
resistor = (resistor/(NUM_SAMPLES_POLLED/2));
fotoresistor = (fotoresistor/(NUM_SAMPLES_POLLED/2));
uint32_t fotoR_light_percent = fotoresistor*(100.0/ADC_RESOLUTION);
uint32_t fotoR_voltage = fotoresistor*(3300.0/ADC_RESOLUTION);
uint32_t resistor_percent = resistor*(100.0/ADC_RESOLUTION);
uint32_t resistor_voltage = resistor*(3300.0/ADC_RESOLUTION);
QM_PRINTF("\nResistor med.: %d\n",(unsigned int)resistor);
QM_PRINTF("Fotores. med.: %d\n",(unsigned int)fotoresistor);
QM_PRINTF("Light %d%% ADC:(%d,%d V)\n", (int)fotoR_light_percent, (int)fotoR_voltage/1000, (int)fotoR_voltage%1000);
QM_PRINTF("Res. sett.: %d%% vol. on res. %d,%d V\n", (int)resistor_percent, (int)resistor_voltage/1000, (int)resistor_voltage%1000);
I found a list with the format specifiers that are used in C. Take a look at http://www.codeforwin.in/2015/05/list-of-all-format-specifiers-in-c.html and try the options for double data types.