Code:
char temp[100];
char arraystring[5];
float adjustvalue = 1.5; // my LM35 was difference 1.5 kelvin to the mechanical thermometer to much .. so i substrakt this from measuring value later..
float adc_value;
int decimal, whole;
...
...
adc_value = adc_read();
adc_value = ((adc_value * 1000 / 1024 / 9.31 ) - adjustvalue );
whole = adc_value;
decimal = ( adc_value - whole ) * 10 ; // only deci ..
..
..
os_sprintf(arraystr, "%2d.%i", whole, decimal ); // look like 17.5
os_sprintf(temp,"Temp measuring was: %s °C", arraystr);
uart0_sendStr(temp);
..
Code:
os_sprintf(temp,"Temp measuring was: %2d.%i °C", whole, decimal);
uart0_sendStr(temp);
Code:
-10.-3 °C
Statistics: Posted by rudi — Mon Nov 17, 2014 7:46 pm
Statistics: Posted by vishnu046 — Mon Nov 17, 2014 6:39 pm
Code:
char temp[100];
os_sprintf(temp, " Where is my Float : %f \r", 12.34);
os_sprintf(temp, " Where is my Float : %2.2f \r", 12.34);
os_sprintf(temp, " Where is my Float : %.2f \r", 12.34);
Code:
os_sprintf(temp, " Where is my Float : %e \r", 12.34);
os_sprintf(temp, " Where is my Float : %E \r", 12.34);
Statistics: Posted by rudi — Fri Nov 14, 2014 3:33 am