Adafruit TFT 2.8 w. Capacitive not displaying time correctly

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Adafruit TFT 2.8 w. Capacitive not displaying time correctly

Post by corderopilot »

Hi! i have product id: 1947 and plan to use it as a display for aquarium controller.
When i try to display my RTC on the screen,the new number get print on top of the old number,superimposed on top... i got no idea on how to resolve this problem, is in the programing..any help? i will post the code as soon i get home form work.
Last edited by corderopilot on Fri Jan 16, 2015 12:27 am, edited 2 times in total.

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not dispaying time correc

Post by corderopilot »

Code: Select all

#include <Adafruit_GFX.h>    // Core graphics library
#include <SPI.h>       // this is needed for display
#include <Adafruit_ILI9341.h>
#include <Wire.h>      // this is needed for FT6206
#include <Adafruit_FT6206.h> //el touchscreen
#include <ds3231.h>
// The FT6206 uses hardware I2C (SCL/SDA)
Adafruit_FT6206 ctp = Adafruit_FT6206();//ctp=capacitive touch pannel

// The display also uses hardware SPI, plus #9 & #10
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
int sector(80);
void setup(){
tft.begin();
Wire.begin();
 if (! ctp.begin(30))
 while (1);
 tft.fillScreen(ILI9341_BLACK);  //this is the backgroung
 Serial.begin(9600);
 //just a silly test.uncomment to view..
/* void testdrawrects(uint16_t color); {(ILI9341_BLACK);
  for (int16_t x=0; x < tft.width(); x+=6) {
    tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, ILI9341_YELLOW);
    tft.fillScreen(ILI9341_BLACK);
  }}*/
 //Draw selection sector
 tft.drawRect(0,0,240,80,ILI9341_RED);//dibuja el cuadro del sector 1 (lugar x,lugar y,tamaño x,tamaño y,color);
 tft.drawRect(0,sector,240,80,ILI9341_RED);
 tft.drawRect(0,sector*2,240,80,ILI9341_RED);
 tft.drawRect(0,240,75,80,ILI9341_RED);//theese
 tft.drawRect(75,240,75,80,ILI9341_RED);//are the last
 tft.drawRect(150,240,90,80,ILI9341_RED);//tree boxes

   
   tft.setCursor(0,115);
   tft.setTextSize(2);
   tft.println("        TEMP '1'         ");

   tft.setCursor(0,190);
   tft.setTextSize(2);
   tft.println("        TEMP '2'         ");  
    
   tft.setCursor(14,260);
   tft.setTextSize(2);
   tft.println("leds"); 
   tft.setCursor(2,295);
   tft.println("ON/OFF");
   
   tft.setCursor(83,260);
   tft.setTextSize(2);
   tft.println("PUMPS"); 
   tft.setCursor(77,295);
   tft.println("ON/OFF");
   
   tft.setCursor(152,260);
   tft.setTextSize(2);
   tft.println("CHILLER"); 
   tft.setCursor(160,295);
   tft.println("ON/OFF");
}
void loop(){ 
        struct ts t;//this is RTC program
        DS3231_get(&t); //Get time
        tft.setCursor(0,115);
        tft.setTextSize(2); 
        tft.setTextColor(ILI9341_YELLOW);//any color
        tft.setCursor(70,35); 
        tft.print(t.hour);
        tft.print(":");
        if(t.min<10)
        {
          tft.print("0");
        }
        tft.print(t.min);
        tft.print(":");
        if(t.sec<10)
        {
          tft.print("0");
        }
        tft.print(t.sec);
            
   // Wait for a touch
  if (! ctp.touched()) {
    return;
  }
  // Retrieve a point  
  TS_Point p = ctp.getPoint();
   // flip it around to match the screen.
  p.x = map(p.x, 0, 240, 240, 0);
  p.y = map(p.y, 0, 320, 320, 0);
  
   // Print out the remapped (rotated) coordinates
  Serial.print("("); Serial.print(p.x);
  Serial.print(", "); Serial.print(p.y);
  Serial.println(")");
  
  if(p.x<= 80 && p.y>=240){ tft.drawRect(0,240,75,80,ILI9341_WHITE);}
  else{ tft.drawRect(0,240,75,80,ILI9341_RED);}
  delay(5);
  
  if(p.x >= 80 && p.x <=160 && p.y >=240){ tft.drawRect(75,240,75,80,ILI9341_WHITE);}
  else{ tft.drawRect(75,240,75,80,ILI9341_RED);}
  delay(5);
  if(p.x >= 160 && p.x <=240 && p.y >=240){ tft.drawRect(150,240,90,80,ILI9341_WHITE);}
  else{ tft.drawRect(150,240,90,80,ILI9341_RED);}
  delay(5);
}
//copy and pasted program,with just a touch of head bang..lol]
Last edited by Franklin97355 on Thu Jan 15, 2015 12:15 am, edited 1 time in total.
Reason: Added missing [code] tags

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

Anyone?

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

perhaps a picture...
[/img]
20150111_083058.jpg
20150111_083058.jpg (90.81 KiB) Viewed 328 times
[img]

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by Franklin97355 »

Are you clearing the display between writes? Post a picture of the whole screen please.

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

[img]
20150111_083022.jpg
20150111_083022.jpg (124.39 KiB) Viewed 324 times
[/img]

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

how do i clear the display between writes? sorry but i have a month trying to do what you see on te pics,never have programmed anything before.

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

20150116_001036.jpg
20150116_001036.jpg (82 KiB) Viewed 322 times
20150116_001111.jpg
20150116_001111.jpg (131.75 KiB) Viewed 322 times

User avatar
stratosfear
 
Posts: 18
Joined: Tue Dec 31, 2013 8:21 am

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by stratosfear »

setTextColor can also specify a background color.

Code: Select all

  tft.setTextColor(ILI9341_CYAN, ILI9341_BLACK);  //cyan text and black background to eliminate artifacts
Jon

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

tft.setTextColor(ILI9341_CYAN, ILI9341_BLACK); //cyan text and black background to eliminate artifacts
That do the trick. thanks a lot for your help!!

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

20150116_115504.jpg
20150116_115504.jpg (104.67 KiB) Viewed 271 times
now is working as intended,i miss the Adafruit_GFX.h command; setTextColor(uint16_t c, uint16_t bg),where "bg is background"
file https://github.com/adafruit/Adafruit-GF ... ruit_GFX.h GFX.h is where you find the commands of the library. Once again thanks Jon for your help!!

User avatar
corderopilot
 
Posts: 10
Joined: Thu Nov 20, 2014 7:56 pm

Re: Adafruit TFT 2.8 w. Capacitive not displaying time corre

Post by corderopilot »

I need to make the Switches work...one press "on" press it again "OFF" so far i just can make it turn "on" on a single press but no off..any one have an idea how to do that?

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”