Go Down

Topic: 3.5"" tft crash on i2c call (Read 140 times) previous topic - next topic

fifidlk

Hello.

I'm new to this forum si excuse me if I post on the wrong place.

I wrote an alarm clock test sketch using arduino UNO, kuman 3.5" tft (ILI9481 or ILI9488 based) shield and a DS3231 i2c card. TFT works fine as long as I don't try to access RTC card wich cause TFT turns all white and do not respond anymore after this access.

I2C bus scl/sda not connected to TFT shield. DS3231 reads are valid ans correct. Using a different lib for i2c access changes nothing.

Here's the code - i2c access is  line 79 in function affDate(). If somebody see something stupid in this code or have an idea about libs conflict I'll be very gratefull


Code: [Select]

#if 1

#include <Arduino.h>
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>

#include <TouchScreen.h>
#include "radiobuttons.h"

#include <Wire.h>
#include <DS3231.h>

//********************************
 
 void affDate(void);
 bool Touch_getXY(void);
 
 //*********************************
 
 
// ALL Touch panels and wiring is DIFFERENT
// copy-paste results from TouchScreen_Calibr_native.ino
 
MCUFRIEND_kbv tft;
TouchScreen TouchS = TouchScreen(XP, YP, XM, YM, 300);


RTClib RtClock;

void setup(void)
{
    // initialisation horloge
   
   
    Wire.begin();
    Serial.begin(9600);
    uint16_t ID = tft.readID();
     if (ID == 0xD3D3) ID = 0x9486; // write-only shield
    tft.begin(ID);
#if defined _TFT_LANDSCAPE
    tft.setRotation(1);       
#endif
#if defined _TFT_PORTRAIT
    tft.setRotation(0);       
#endif
   
    tft.fillScreen(WHITE);
    tft.setTextSize(10);
    tft.setCursor(120,50);
    tft.setTextColor(BLACK);
    tft.print("17:42");
    tft.setCursor(120,130);
    tft.setTextColor(BLUE);
    tft.setTextSize(3);
    tft.println("test ");

}
// ******************************************************

void loop(void)
{

    delay(900);   

    affDate();

   
}
#endif


  // ***********************************************
 
  void affDate(void) {
 
  char buff[128];
 
// ******* Here is the problem !!!! **********
    DateTime now = RtClock.now();
// *******************************************
   
    Serial.println("Actif. ");
    Serial.println(now.second());
    tft.setTextSize(10);
    tft.setCursor(120,50);
    tft.setTextColor(BLACK);
    tft.print("17:42");


 
  }

  // **************************************************
 
....

Go Up