Well I got problem with my TFT shield.
I'm running it on arduino mega, it got ILI9341 driver.
Here is how its look like:
And this is code:
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#include <SPI.h>
#include "Adafruit_GFX.h"
#include <MCUFRIEND_kbv.h>
#include "RTClib.h"
MCUFRIEND_kbv tft;
RTC_DS1307 rtc;
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int i;
void setup(void){
tft.reset();
uint16_t identifier = tft.readID();
tft.begin(identifier);
tft.fillScreen(BLACK);
tft.setTextSize(1);
if(! rtc.begin()) {
tft.setCursor(0,5);
tft.print("cant fing RTC");
}
while(! rtc.begin()){
tft.setCursor(i,20);
tft.print(".");
i=i+5;
delay(1000);
}
if (! rtc.isrunning()) {
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
tft.fillScreen(BLACK);;
}
void loop(void){
tft.setTextSize(WHITE,BLACK);
tft.setCursor(2,2);
tft.setTextSize(2);
tft.print("date:");
DateTime now = rtc.now();
tft.print(now.year(), DEC);
tft.print('/');
tft.print(now.month(), DEC);
tft.print('/');
tft.print(now.day(), DEC);
tft.print(" (");
tft.print(daysOfTheWeek[now.dayOfTheWeek()]);
tft.print(") ");
tft.setCursor(2,18);
tft.print("time:");
tft.print(now.hour(), DEC);
tft.print(':');
tft.print(now.minute(), DEC);
tft.print(':');
tft.print(now.second(), DEC);
tft.println();
}
Anyone have idea what is a problem and how to fix it?
Ask if you need some more info about it.
Thanks.