Hello all, please I need your help. I have a Mega2560 with 2.4 MCU friend on
#include <Adafruit_GFX.h>
In the static texts is all running without problems (if I have used whole display clear screen) , but if I need dynamic values, like a temperature, or PCF8563 values indicate on it, automatically changed values from Seconds (and next in minutes and hours) are mixed together (overlapping).
What about it ? What can I do for it ?
Thanks for your each answers. Bobo
Display characters mixed
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 13
- Joined: Sat Sep 07, 2013 6:54 pm
Display characters mixed
Last edited by felixlu28 on Sun Aug 30, 2015 2:30 pm, edited 1 time in total.
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Display characters mixing
Could you post your code (using the </> button for posting code) and the connections you have in your circuit?
-
- Posts: 13
- Joined: Sat Sep 07, 2013 6:54 pm
Re: Display characters mixing
Hi Franklin, here you have a code :
This is the basic code for testing. Some of parts are included in full version but this code running same as full.
Also I have attached a files, I am using it in this project.
Bobo
Code: Select all
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>
#include <SD.h>
#include <SPI.h>
#include <Rtc_Pcf8563.h>
#include <Wire.h>
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
#define SD_CS 53 // Card select for shield use
#define YP A1 // must be an analog pin, use "An" notation!
#define XM A2 // must be an analog pin, use "An" notation!
#define YM 7 // can be a digital pin
#define XP 6 // can be a digital pin
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#define GREY 0x7BEF
#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
uint8_t spi_save;
Rtc_Pcf8563 rtc;
void setup() {
Serial.begin(9600);
uint16_t identifier = tft.readID();
identifier = 0x9341;
tft.begin(identifier);
tft.setRotation(3);
tft.fillScreen(BLACK);
tft.drawRect(2, 2, 310, 230, WHITE);
tft.setCursor(35, 10);
tft.setTextColor(YELLOW); tft.setTextSize(2);
tft.println("ClimaTech air system");
tft.drawLine(2, 35, 310, 35, WHITE);
tft.setCursor(15, 75);
tft.println("Act.temp :");
tft.setCursor(250, 65);
tft.println(".");
tft.setCursor(260, 75);
tft.println("C");
tft.setCursor(15, 95);
tft.println("Set.temp :");
tft.setCursor(190, 95);
tft.println("");
tft.setCursor(250, 85);
tft.println(".");
tft.setCursor(260, 95);
tft.println("C");
tft.setCursor(15, 115);
tft.println("Out.temp :");
tft.setCursor(250, 105);
tft.println(".");
tft.setCursor(260, 115);
tft.println("C");
tft.setCursor(15, 135);
tft.println("Out.humidity :");
tft.setCursor(260, 135);
tft.println("%");
}// setup
void loop() {
tft.setCursor(15, 45);
tft.setTextColor(WHITE); tft.setTextSize(2);
tft.println(rtc.formatTime(RTCC_TIME_HMS));
tft.setCursor(180,45);
tft.println(rtc.formatDate(RTCC_DATE_WORLD));
}//loop
Also I have attached a files, I am using it in this project.
Bobo
- Attachments
-
- AdaTFTLCD.zip
- (141.13 KiB) Downloaded 18 times
-
- Adafruit-GFX-Library-master7_2015.zip
- (10.82 KiB) Downloaded 14 times
-
- Posts: 13
- Joined: Sat Sep 07, 2013 6:54 pm
Re: Display characters mixing
About connections : Is connected with Mega2560 directly (shield) as been described on Adafruit page like other producer products.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Display characters mixed
Try setting a background color for the text:
That will erase any old characters when it draws new ones.
Code: Select all
tft.setTextColor( YELLOW, BLACK );
Please be positive and constructive with your questions and comments.