GLCD Print Decimals

Please can anyone help me this code takes the reading from a temp sensor and prints it to the glcd screen .
The problem I have is I cant get it to print decimals so if the temp is 16.89 it prints 0016 Thank You 




[code#include <UTFT.h> 
#include <URTouch.h>
 int ThermistorPin = A0;
float Vo;
float R1 = 10000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
UTFT    myGLCD(ILI9341_16,38,39,40,41); //Parameters should be adjusted to your Display/Schield model
URTouch  myTouch( 6, 5, 4, 3, 2);

//==== Defining Variables
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
const int VCC = 13;


void setup() {
 myGLCD.InitLCD();
  myGLCD.clrScr();
  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
 digitalWrite(VCC, HIGH);
  // Defining Pin Modes
 pinMode(VCC, OUTPUT); 

}

void loop() {
 
   Vo = analogRead(ThermistorPin);
  R2 = R1 * (1023.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
  T = T - 275.65;
  
  myGLCD.setFont(BigFont);
    
    myGLCD.setColor(0, 255, 0);
    myGLCD.setBackColor(0, 0, 0);
    myGLCD. printNumI (T,240, 50, 4,'0');

   }]

Look at your UTFT.PDF manual. I suspect that if there is a printNumI() method for integers, there will be a printNumF() method for floats.

yes I have replaced the numI with numF but then it gives me 1606789

Have you read the manual? The syntax for the two methods is different.

The whole calculation looks very complicated. Are you sure that it is correct?

Think about it. You reeive an ADC value from the Sensor. e.g. between 0 and 1023. Then perform lots of f-p arithmetic.

You can always check the maths by putting V0 in a for loop and print the resultant T values on the Serial Terminal. I would guess that the degrees are only valid for a small range of V0. Life is much simpler with a sensor like LM75 or DS18B20.

David.

thanks

myGLCD. printNumF (T,2,100,10);

easy when you know where to look