Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFT LCD 2.4" ILI 0x9341 not working with DateTime class #223

Open
OPiElix opened this issue Jan 5, 2023 · 0 comments
Open

TFT LCD 2.4" ILI 0x9341 not working with DateTime class #223

OPiElix opened this issue Jan 5, 2023 · 0 comments

Comments

@OPiElix
Copy link

OPiElix commented Jan 5, 2023

As soon as I write in the loop() a DateTime object (no matter where), the TFT doesn't load (it remains white).
Here is my he code:

#include <MCUFRIEND_kbv.h>
#include <Adafruit_GFX.h>   // Hardware-specific library
#include "RTClib.h"

// Assign human-readable names to some common 16-bit color values:
#define	BLACK   0x0000
#define	BLUE    0x001F
#define	RED     0xF800
#define	GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

MCUFRIEND_kbv tft;
RTC_DS3231 rtc;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);     
  Serial.println("setup started");
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    while (1) delay(10);
  }      
  //rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  uint16_t ID = tft.readID();  
  Serial.print("ID = 0x");
  Serial.println(ID, HEX);
  if (ID == 0xD3D3) ID = 0x9481; // write-only shield
  tft.begin(ID);
  Serial.println("TFT begun");
  tft.fillScreen(BLACK);
  tft.setRotation(3);  
  Serial.println("exit setup, enter loop()");
}

void loop() {
  // put your main code here, to run repeatedly:
  //  tft.setTextColor(YELLOW, BLACK);
  //DateTime now = rtc.now(); //uncommented not letting the TFT load
  //Serial.println(now.hour());  // same as above
  Serial.println("entered loop");  
  tft.setTextSize(3);
  tft.setCursor(0, 0);
  Serial.println("starting welcome screen");
  tft.println("hello world!");  
  tft.setTextSize(2);
  Serial.println("relocating cursor");  
  tft.setCursor(0, 50);
  tft.println("Welcome To TFT Clock ");  
  delay(2000);
  Serial.println("ended welcome screen");  
  //tft.fillScreen(BLACK);  
  tft.setCursor(50, 50);
  //tft.print(now.hour(), DEC);  
  Serial.println("time shown");
  delay(3000);
}

(If you need me to add something else just say it)
Thanks, Opilite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant