utft display leaning the code structure

hello i just fired up my first display on an arduino i have only had simple adruino use needs, up till now !

i have built a pneumatic press witch pushes press pins in for me its a simple thing that the arduino handles i have a mega doing it i know its over kill so i thought i would add on for fun so i picked up a liner transducer and a air pressure transducer sensor and there some math with pie i can write a value to the serial communication the foot pounds of pressure being applied to the press pin ,… why ?
well just because we can right ? there not real need to know im just having fun with the project

that being said i picked up a

SainSmart Mega2560 R3 + 3.2" TFT Touch LCD SD Card + TFT Shield Kit For Arduino

and got the libraries up and running and the example demo code working and then played around with the example demo code a bit got some brownie points leaving a repeating text message fort he girl friend before i left for work , so she could find it later on the desk top !

ok so now that i gave some back ground and we all up to speed here what im trying to do the pin press transducer gives me a value for the foot pounds applied to the pin when it is press i would like to use this display to get a read out installed on the press for every time it is activated it displays the rising pressure number to the tft lcd !

so i was able to modfie the example code to right the girl friend a message but that was a print line (" I LOVE YOU " )

and i need a print line that is more like this

{
    myGLCD.setFont(SevenSegNumFont);
    myGLCD.setColor(0, 255, 0);
  
    myGLCD.print("psi", 200, 0, 90);
      myGLCD.print( SensorValue , 200, 0, 90);}

but it dose not seem to like this can i not display a value that is live being read by and anlog pin live to the display ?

OK so this is an idea i had is kind of does what im looking for but not efficiently if i have to create and if condition for every digit i posable to get witch is some thing like 2500

#include <UTFT.h>
int sensorValue = 0;
// Declare which fonts we will be using
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Uncomment the next line for Arduino 2009/Uno
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

// Uncomment the next line for Arduino Mega
//UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

void setup()
{
    // initialize serial communication at 9600 bits per second:

    Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
   
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);
  
    // send an intro:
  Serial.println("send any byte and I'll tell you everything I can about it");
  Serial.println();
  
}
void clearField()
{
  myGLCD.setColor(VGA_BLACK);
  myGLCD.fillRect(1,15,318,224);
}

void loop()
{
 
   int sensorValue = analogRead(A7);

 
    myGLCD.setFont(SevenSegNumFont);
    myGLCD.setColor(0, 255, 0);
   
   if (sensorValue < 1){
       myGLCD.setFont(BigFont);
     myGLCD.print("-MIN-",132,90, 0);
    } 
      if (sensorValue > 1){
     myGLCD.print("002",132,90, 0);
    } 
      if (sensorValue >20){
     myGLCD.print("021",132,90, 0);
    } 
      if (sensorValue > 50){
     myGLCD.print("055",132,90, 0);
    } 
      if (sensorValue > 100){
     myGLCD.print("100",132,90, 0);
    } 
      if (sensorValue > 200){
     myGLCD.print("200",132,90, 0);
    } 
  
      if (sensorValue > 350){
     myGLCD.print("350",132,90, 0);
    } 
      if (sensorValue > 460){
     myGLCD.print("460",132,90, 0);
    } 
      if (sensorValue > 570){
     myGLCD.print("570",132,90, 0);
    } 
      if (sensorValue > 680){
     myGLCD.print("680",132,90, 0);
    } 
      if (sensorValue > 790){
     myGLCD.print("790",132,90, 0);
    } 
      if (sensorValue > 900){
     myGLCD.print("905",132,90, 0);
    } 
    

    
     if (sensorValue > 970){
        myGLCD.setFont(BigFont);

     myGLCD.print("-MAX-",132,90, 0);
  
    } 
    
delay(500);


}

You might want to have a look at the UTFT Manual available here http://www.henningkarlsen.com/electronics/library.php?id=52

In particular, have a look at the difference between the print, printNumI and printNumF functions.

Let us know how you go....

ahh i missed this some where !

this is a complete success now !
thanks for turning me on to that link between what i could read up on there and finding some thing unexplained in there example code i came up with a simplified working code exactly the way i was hoping it would be !

heres a copy of what i got so far !
now it displays exactly the pin read times 10 X 10 for the extra 2 place read out i will require later threw math formulas for pi and leverage , but this will do ! i believe a can map and create a threshold with this wrapper and get exactly what i want a clean cut screen read out !

thanks again and i hope this helps some one eles out to i did not see it explained and where but i may have missed the construct of this key thing some where

myGLCD.printNumI(sensorValue ,132,90, 0);
delay(5);

#include <UTFT.h>
int sensorValue = 0;
// Declare which fonts we will be using
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

// Uncomment the next line for Arduino 2009/Uno
UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

// Uncomment the next line for Arduino Mega
//UTFT myGLCD(ITDB32S,38,39,40,41);   // Remember to change the model parameter to suit your display module!

void setup()
{
    // initialize serial communication at 9600 bits per second:


   
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);
  
   myGLCD.print("FOOT POUNDS", 0, 0);
    myGLCD.setColor(0, 0, 255);
}
void clearField()
{
  myGLCD.setColor(VGA_BLACK);
  myGLCD.fillRect(1,15,318,224);
}

void loop()
{
 
   int sensorValue = analogRead(A7);
   
 sensorValue = (sensorValue*10); 
    myGLCD.setFont(SevenSegNumFont);
    myGLCD.setColor(0, 255, 0);
   
 
    
  myGLCD.printNumI(sensorValue ,132,90, 0);
     delay(5);
  
    
    
    



}

Good to see you got it sorted :)

Cheers

If you want to get the touchscreen to work, The UTouch class will just do you brain in. I wrote this recently by modifying the sainsmart code into something more useable. They used a dodgy chip on the board.

Display bitmaps off flash card in /images folder. http://technomungo.blogspot.com.au/2013/12/sainsonic-arduino-mega-touchscreen-bmp.html

Cheers Brad