Go Down

Topic: counter with 2.2 TFT ILI9340_Adafruit (Read 480 times) previous topic - next topic

va_cristi

Hello!
I try to make a counter.
I have an Arduino Nano and a display, 2.2 TFT 240x320 IPS.
Display is superimposed figures.
How can I remove overlapping figures.
Code: [Select]

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"

#define BLACK    0x0000
#define GRAY     0x8410
#define BLUE     0x001F
#define RED      0xF800
#define ORANGE   0xFA60
#define GREEN    0x07E0
#define CYAN     0x07FF
#define AQUA     0x04FF
#define MAGENTA  0xF81F
#define PINK     0xF8FF
#define YELLOW   0xFFE0
#define LIME     0x07FF
#define WHITE    0xFFFF


#if defined(__SAM3X8E__)
#undef __FlashStringHelper::F(string_literal)
#define F(string_literal) string_literal
#endif

// These are the pins used for the UNO
// for Due/Mega/Leonardo use the hardware SPI pins (which are different)
#define _sclk 13
#define _miso 12
#define _mosi 11
#define _cs 5 // 10
#define _dc 6 // 9
#define _rst 4 // 8

// Using software SPI is really not suggested, its incredibly slow
Adafruit_ILI9340 tft = Adafruit_ILI9340(_cs, _dc, _mosi, _sclk, _rst, _miso);

//extern uint8_t Vent[];
uint8_t rotation = 3;


#define BACKCOLOR 0x841F
#define CHARCOL 0xFFFF
#define CHARBACK 0x841F

void setup() {


  tft.begin();
  // uint8_t rotation = 3;
  tft.setRotation(rotation);
  tft.fillScreen(ILI9340_BLACK);
  tft.setTextColor(ILI9340_BLACK); tft.setTextSize(0);
  tft.println(1234.56);
  //tft.setRotation(rotation);

}

void loop() {

  tft.setTextColor(ILI9340_YELLOW);  tft.setTextSize(4);
  tft.setCursor(0, 0);
  tft.println("");

  for(int i=0; i<50; i++){
    i++;
    tft.setTextColor(ILI9340_YELLOW);  tft.setTextSize(4);
    tft.setCursor(5, 162);
    tft.println(i);

    delay(1000);
    if ( i>=10 ) {  i = 0; }
    }

}




va_cristi

#1
Feb 13, 2017, 05:12 am Last Edit: Feb 13, 2017, 05:17 am by va_cristi
I succeeded.

ILI9340_YELLOW, /*color text */ ILI9340_BLACK /*color background*/


Code: [Select]
for(int i=0; i<50; i++){
  tft.setTextColor(ILI9340_YELLOW, /*color text */ ILI9340_BLACK /*color background*/;  tft.setTextSize(4);
  tft.setCursor(5, 162);
  tft.println(i);

  delay(1000);
  if ( i>=10 ) {  i = 0; }
  

Go Up