Hello all,
I recently bought a SainSmart 3.2" Touchscreen and shield for my Mega and have a several questions about fonts and the display itself. I have enclosed a sample sketch for your review... The Questions are as follows.
-
Is there a list of the different fonts I can use on the net somewhere for reference for the library I am using? I have been searching but only have found three thus far...
-
When using the seven Segment font how does one not display the numbers after the decimal point. (IE: Just the whole number.
I am sure I will have other questions to follow but those are the most important for now... Thanks in advance for any help you can be,,,
#include <UTFT.h>
#include <ITDB02_Touch.h>
#include <thermistorFun.h>
//Declare font types
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];
//Gets the screen and touch sensor ready
UTFT myGLCD(ITDB32S,38,39,40,41);
ITDB02_Touch myTouch(6,5,4,3,2);
//Define my variables
float x = 0, y = 0;
int run = 0;
int temp;
bool error = true;bool changed = true;
//New vars....
float T1;float T2;float temperature;float humidity;
float dp;int cnt;
void setup(){
//Setup the Screen
myGLCD.InitLCD();
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
myGLCD.clrScr();
}
void loop(){
// Gets DHT11 Data apx. every 80 miliseconds
cnt ++;
if(cnt == 10){
T1 = thermistorRead(A0);
T1 = T1 * .979;
temperature = (round(T1));
cnt=0; // resets count
}
//*************** TS & Display ********************
//reads x and y values of touch sensor
read_ts();
//prints these values to the screen
myGLCD.setFont(BigFont);
myGLCD.setColor(255, 0, 255);
myGLCD.printNumF(x,3,50,150);
myGLCD.printNumF(y,3,50,175);
myGLCD.print("TFT Test Screen.", CENTER, 200);
myGLCD.setFont(SevenSegNumFont);
myGLCD.printNumF(round(temperature),0,50,15);
}
// *************** End Loop **************************
void read_ts()
{
myTouch.read();
x = myTouch.getX();
y = myTouch.getY();
x = map(x, 0, 239, 239, 0); // Rev to match Display
y = map(y, 0, 319, 319, 0); // Rev to match Display
}
// ( THE END )