Hi, I display the time and date on a LCD color display, but I was unable properly refresh the display.
At the end of my program , I added the " ucg.clearScreen (); " but the display is refreshed every four seconds , and this is not practical.
here my code
#include <SPI.h>
#include "Ucglib.h"
#include <DS3231.h>
// Init the DS3231 using the hardware interface
DS3231 rtc(SDA, SCL);
Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9 , /*cs=*/ 10, /*reset=*/ 8);
void setup(void)
{
rtc.begin();
ucg.begin(UCG_FONT_MODE_TRANSPARENT);
//ucg.begin(UCG_FONT_MODE_SOLID);
ucg.clearScreen();
// rotation de 90°
ucg.setRotate90();
ucg.setColor(0, 3, 6, 20 );
ucg.setColor( 1, 13, 22, 66 );
ucg.setColor( 2, 21, 37, 115 );
ucg.setColor( 3, 29, 50, 150 );
ucg.drawGradientBox(1,1,320,240);
// The following lines can be uncommented to set the date and time
// rtc.setDOW(Dimanche); // Set Day-of-Week to SUNDAY
// rtc.setTime(14, 22, 0); // Set the time to 12:00:00 (24hr format)
// rtc.setDate(13, 9, 2015); // Set the date to January 1st, 2014
}
void loop(void)
{
// affiche le jour
ucg.setFontPosBaseline();
ucg.setFont(ucg_font_ncenB18);
ucg.setColor(255, 255, 255);
ucg.setPrintPos(45,30);
ucg.setPrintDir(0);
ucg.print(rtc.getDOWStr());
// affiche la date
ucg.setFontPosBaseline();
ucg.setFont(ucg_font_ncenB18);
ucg.setColor(255, 255, 255);
ucg.setPrintPos(100,60);
ucg.setPrintDir(0);
ucg.print(rtc.getDateStr());
// affiche l'heure
ucg.setFontPosBaseline();
ucg.setFont(ucg_font_ncenB18);
ucg.setColor(255, 255, 255);
ucg.setPrintPos(50,90);
ucg.setPrintDir(0);
ucg.print(rtc.getTimeStr());
ucg.clearScreen();
}


