'tft' does not name a type Arduino TFT 2,8 Zoll

Hello Friends

I have a mistake in my Sketch

anyone have a Tip

here my Sketch

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

Also please post the actual error message.

…R

#include <ESP8266WiFi.h>
#include <time.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC D3
#define TFT_CS D1

#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

//const char* ssid = "Esu-ModellbahnWlan"; //# WLAN-User anpassen
const char* ssid = "Netzwerkerkennung-fehlgeschlagen"; //# WLAN-User anpassen
const char* pass = "pokerface2000"; //# WLAN-Passwort anpassen
int old_sec;
int h,m,s,ho,mo,so;
Adafruit_ILI9341 tft= Adafruit_ILI9341(TFT_CS, TFT_DC);
#define PROGMEM 
//#define db_width 60
//#define db_height 45
PROGMEM const unsigned char db_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff,
0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00,
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0xaf, 0xaa, 0xaa,
0xaa, 0x2a, 0x1f, 0x00, 0x80, 0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00,
0x00, 0x00, 0x1e, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00,
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff,
0xff, 0xff, 0x07, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

tft.fillRect(10, 20, 64, 45, ILI9341_WHITE);
tft.drawXBitmap(10, 20, db_bits, 60, 45, ILI9341_RED);

// TH
void setup() {
  Serial.begin(115200);
  Serial.println("test");
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    }
  Serial.println("connected");
  configTime(2*3600, 0, "0.de.pool.ntp.org");
  Serial.println("NTP ok");
  tft.begin();
  tft.fillScreen(ILI9341_BLUE);
  tft.setRotation(1);

  tft.fillRect(0,0,350,32,BLACK);
/// Abfahrt
  tft.setTextColor(WHITE, BLACK);
  tft.setCursor(100,5);
  tft.setTextSize(3);
  tft.print("Abfahrt");

  //tft.drawXBitmap(5, 10, myBitmap, 25, 20);
  //tft.drawXBitmap(5, 5, myBitmap, 25, 20, RED);
 //  tft.drawXBitmap(20, 80, myBitmap, 50, 40, 0xFFFF);

  //Zeile 1
  tft.setTextSize(2);
  tft.setTextColor(WHITE, BLUE);
  tft.setCursor(0, 35);
  tft.print("19:15");

  tft.setCursor(65, 35);
  tft.setTextColor(BLUE, WHITE);
  tft.print("RE59");

  tft.setTextColor(WHITE, BLUE);
  tft.setCursor(160, 35);
  tft.print("Hamm");

  tft.setCursor(305, 35);
  tft.print("1");
  
  //Zeile 2
  tft.setTextSize(2);
  tft.setTextColor(WHITE, BLUE);
  tft.setCursor(0, 55);
  tft.print("19:17");

  tft.setCursor(65, 55);
  tft.setTextColor(BLUE, WHITE);
  tft.print("RE2014");

  tft.setTextColor(WHITE, BLUE);
  tft.setCursor(160, 55);
  tft.print("Altenbeken");

  tft.setCursor(305, 55);
  tft.print("1");

   //Zeile 3
  tft.setTextSize(2);
  tft.setTextColor(WHITE, BLUE);
  tft.setCursor(0, 75);
  tft.print("19:25");

  tft.setCursor(65, 75);
  tft.setTextColor(BLUE, WHITE);
  tft.print("RE2055");

  tft.setTextColor(WHITE, BLUE);
  tft.setCursor(160, 75);
  tft.print("Paderborn");

  tft.setCursor(305, 75);
  tft.print("2");
  
  }
void loop() {
  time_t now = time(nullptr);
  if (localtime(&now)->tm_sec !=old_sec){
    old_sec = localtime(&now)->tm_sec;
    tft.setTextSize(2);
    h=localtime(&now)->tm_hour;
    m=localtime(&now)->tm_min;
    s=localtime(&now)->tm_sec;
    tft.setTextColor(ILI9341_BLUE);
    //tft.setCursor(180,0);
    if(ho != h){
      if (ho<10) tft.print("");
      tft.print(ho);
      }
    tft.setCursor(0,0);
tft.setTextColor(ILI9341_BLACK);
    if(mo != m){
      if (mo<10) tft.print("");
      tft.print(mo);
      }
    tft.setCursor(216,0);

    //if (s != so){
      //if (so<10) tft.print("");
      //tft.print(so);
      }
    tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
    //tft.setTextSize(2);
    tft.setCursor(255,10);
    if (h<10) tft.print("");
    tft.print(h);
    tft.print(":");
    if (m<10) tft.print("");
    tft.print(m);
    //tft.print(":");
    //if (s<10) tft.print("");
    //tft.print(s);
    ho=h;mo=m;so=s;
    }
//  }

Your code has several problems.

  1. the constructor omits the TFT_RESET argument. Adafruit examples are designed to fail with Red displays from Ebay.
  2. tft.fillRect() and tft.drawXBitmap() statements must be inside setup()
  3. my ESP8266 does not respond to your SSID and password. i.e. it gets stuck in WiFi.status() loop

Otherwise your program will probably work.

You can defeat Adafruit's trick by using full constructor i.e. with TFT_RESET argument.
Or by adding a real-life external pullup resistor on the TFT_RESET pin.

David.

Edit. This topic was moved from the Displays Forum while I was replying.
I respectfully suggest that it gets moved back to Displays. It is specific to Adafruit_ILI9341

Hello
my WIFI is running 100 % i have my sid and pw the sketch and run ,but the rest have a big bull shit

my error is

'tft' does not name a type

tft.drawXBitmap(10, 20, db_bits, 60, 45, ILI9341_RED); // this make it red for error

please tell me the setup for this

chaoskasi:
Hello
my WIFI is running 100 % i have my sid and pw the sketch and run ,but the rest have a big bull shit

my error is

'tft' does not name a type

tft.drawXBitmap(10, 20, db_bits, 60, 45, ILI9341_RED); // this make it red for error

please tell me the setup for this

hehe.. move it down a few lines so it is within setup()

Hello
wow it´s running but the Display is very fast blinking . I think i take a real-life external pullup resistor.
Plz tell my the real-life external pullup resistor . OHM ????

thx