Bonjour à tous,
j'ai réussi à faire fonctionner mon code permettant de faire un petit chronomètre sur un écran LCD (2x16) sans aucun soucis.
Aujourd 'hui, je me suis lancé et j'ai voulu le basculer sur un écran TFT 2.6
Le code fonctionne à moitié, mais je rencontre un problème au niveau du rafraichissement de l'écran. Les chiffres qui déroulent de mon compteur se superpose au fur et à mesure, donnant l'impossibilité de lire le chronomètre (phénomène que je n'avais pas avec le LCD - technologie différente)
comment puis-je faire pour arriver à une impression de vrai défilement ??
je vous joins une petite vidéo du problème ainsi que le code
en espérant qu une bonne ame puisse m'aider
merci
#define cs A3
#define dc A2
#define wr A1
#define rd A0
#define rst A4
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
#include "TFTLCD.h"
int seconde=0;
int heures=0;
int minutes=0;
int secondes=0;
int mms=0;
int ms=0 ;
long startTime = 1; //That's the timestamp of when the chrono was started
long endTime = 1; //The timestamp of when the chrono has ended
long finalTime = 1; //Basically endTime - startTime
long chronoTime = 1; //The time from the other arduino, to do a comparison
String heuresString =00;
String minutesString =00;
String secondesString =00;
String mmsString= 00 ;
String msString= 00;
String secString = 00;
String centiString = 00 ;
TFTLCD tft(cs, dc, wr, rd, rst);
void setup() {
tft.initDisplay();
tft.fillScreen(BLUE);
}
void loop() {
tft.setCursor(1, 0);
seconde = millis()/1000;
ms = millis()/10 ;
heures = (seconde/3600);
minutes = (seconde-heures*3600)/60;
secondes = seconde-heures*3600-minutes*60;
long time = millis() - startTime;
int centi = (int)(time%1000)/10;
int sec = (int) ((time%60000) / 1000L);
int minutes = (int)(time/60000L);
char message[16] = "";
char text[7] = "Temps:";
if (minutes < 10)
{
minutesString = String(0+String(minutes));
} else {
minutesString = String(minutes);
}
if (sec < 10)
{
secString = String(0+String(sec));
} else {
secString = String(sec);
}
if (centi < 100)
{
centiString = String(0+String(centi));
} else {
centiString = String(centi);
}
// set the font color
tft.setTextColor(WHITE);
tft.setTextSize(2.5);
tft.setCursor(20, 20);
// print the sensor value
tft.print("Temps ") ;
tft.print(minutesString) ;
tft.print(':');
tft.print(secString) ;
tft.print(':');
tft.print(centiString);
}