1,77 Zoll RGB LCD Display mit Arduino Nano

Hallo,

Ich habe das 1,77 Zoll Display von AZ Delivery und wollte das Programm von der Webseite ausführen: Arduino Nano mit 1.77 Zoll SPI TFT-Display – The Logbook…

Wenn ich es genau so wie im Link aufbaue mit dem selben Programm wird die Grafik ein paar Pixel versetzt angezeigt. Der gelbe "Pac-man" ist grau und die Farbe Blau wird in Rot angezeigt usw.

Wodurch ergeben sich die diese Fehler?

mfg

Dann passt der Sketch oder die Library nicht zum Display.
Du solltest uns alle Daten liefern.
Einen Hyperlink zu deinem Display. Hyperlink ist zum Anklicken, keine URL.
Deinen Sketch in Code-Tags.

Hallo,

Das ist das Display:

Habe die Library "Adafruit-ST7735-Library" eingefügt.

Und das ist mein Code dazu:

/***
 * Test für das 1,77 Zoll SPI TFT-Display
 * v1.0 - 2018-01-06
 * Jan Greth <github@greth.me>
 ***/

/* Pinnung
 *  Display (Pin) - Arduino Nano
 *  GND  (1) - GND  
 *  VCC  (2) - 5V
 *  SCK  (3) - D13
 *  SDA  (4) - D11
 *  RES  (5) - D8
 *  RS   (6) - D9
 *  CS   (7) - D10
 *  LEDA (8) - 3.3V
 *  
 *  LEDA kann auch an 5V doch dann wird das Display sehr schnell sehr heiß - was ich nicht für optimal halte.
 *  Beim Betrieb mit 3.3V ist das Dispklay nur minimal dunkler und bleibt kalt.
 */

#define TFT_PIN_CS   10 // Arduino-Pin an Display CS   
#define TFT_PIN_DC   9  // Arduino-Pin an 
#define TFT_PIN_RST  8  // Arduino Reset-Pin

#include <SPI.h>             // SPI für die Kommunikation
#include <Adafruit_GFX.h>    // Adafruit Grafik-Bibliothek wird benötigt
#include <Adafruit_ST7735.h> // Adafruit ST7735-Bibliothek wird benötigt

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_PIN_CS, TFT_PIN_DC, TFT_PIN_RST);  // ST7735-Bibliothek Setup

void setup(void) {

  /***
   * ST7735-Chip initialisieren (INITR_BLACKTAB / INITR_REDTAB / INITR_GREENTAB)
   * Muss bei AZ-Delivery 1.77'' 160x128px RGB TFT INITR_GREENTAB sein ansonsten Pixelfehler rechts und unten.
   * Hinweis: https://github.com/adafruit/Adafruit-ST7735-Library/blob/master/examples/soft_spitftbitmap/soft_spitftbitmap.ino#L52
   * Zeile 52-65  
   ***/
   
  tft.initR(INITR_GREENTAB);   
  
}

void loop() {

  /***  
   * Die tft Funktionen kommen aus der Adafruit Grafik-Bibliothek (Adafruit_GFX) die möglichen Funktionen finden sich unter:
   * https://learn.adafruit.com/adafruit-gfx-graphics-library?view=all
   * bzw.
   * https://cdn-learn.adafruit.com/downloads/pdf/adafruit-gfx-graphics-library.pdf
   ***/

  // fillScreen(farbe);
  tft.fillScreen(ST7735_BLACK);

  // drawRect(pos_links,pos_oben,breite,hoehe,farbe);
  tft.drawRect(0,0,128,160,ST7735_BLUE); 
  
  // setTextSize(groesse);
  tft.setTextSize(1);
 
  // setCursor(links,oben);
  tft.setCursor(30,10);
 
    // setTextColor(farbe);
  tft.setTextColor(ST7735_WHITE);
  
  // print(text);
  tft.print("Hello World!");

  // drawLine(links_start,oben_start,links_ende,oben_ende,farbe);
  tft.drawLine(1,25,127,25,ST7735_BLUE);

  // Hier kommt PacMan!
  int ol = 35;
  int ul = 115;

  do {
    tft.fillCircle(64,75,40, ST7735_YELLOW);
    tft.fillTriangle(65,75, 110,ol, 110,ul, ST7735_BLACK);
    tft.fillCircle(64,60,3, ST7735_BLACK);
    ol = ol + 10;
    ul = ul - 10;
    delay(500);
  } while(ol < 75);

  do {
    tft.fillCircle(64,75,40, ST7735_YELLOW);
    tft.fillTriangle(65,75, 110,ol, 110,ul, ST7735_BLACK);
    tft.fillCircle(64,60,3, ST7735_BLACK);
    ol = ol - 10;
    ul = ul + 10;
    delay(500);
  } while(ol >= 35);

  // setCursor(von links,von oben);
  tft.setCursor(25,135);
  // setTextColor(farbe);
  tft.setTextColor(ST7735_GREEN);
  // print(text);
  tft.print("www.greth.me");

  // 5 Sekunden warten
  delay(5000); 
}

Danke im vorhinein für eure Hilfe :slight_smile:

Ok, sieht von hier erst mal gut aus.
Die passende Grafik-Library hast du auch geladen ?
Hast du auch mal ein Beispiel aus der Library getestet ?

Diese Grafik Library habe ich:

Ist das die richtige? Kenne mich damit leider noch nicht so gut aus.

mich3499:
Diese Grafik Library habe ich:
GitHub - adafruit/Adafruit-GFX-Library: Adafruit GFX graphics core Arduino library, this is the 'core' class that all our other graphics libraries derive from
Ist das die richtige? Kenne mich damit leider noch nicht so gut aus.

Ja, das ist die richtige.
Wenn keiner mehr einen weiteren Tipp hat, solltest du den Lieferanten mal anschreiben.

  // Our supplier changed the 1.8" display slightly after Jan 10, 2012
  // so that the alignment of the TFT had to be shifted by a few pixels
  // this just means the init code is slightly different. Check the
  // color of the tab to see which init code to try. If the display is
  // cut off or has extra 'random' pixels on the top & left, try the
  // other option!
  // If you are seeing red and green color inversion, use Black Tab

  // If your TFT's plastic wrap has a Black Tab, use the following:
  tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  // If your TFT's plastic wrap has a Red Tab, use the following:
  //tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
  // If your TFT's plastic wrap has a Green Tab, use the following:
  //tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab

Auch hervorgehoben: If you are seeing red and green color inversion, use Black Tab

Demnach //tft.initR(INITR_GREENTAB);

durch tft.initR(INITR_BLACKTAB); ersetzen

EDIT:
Quelle ST7735 Color TFT Display Library

Mit dem Display hatte ich auch schon zu tun...

Der Trick ist der mit den "Tabs" - das ist der "Nippel" an der Displayschutzfolie. Passend zu dessen Farbe ent-kommentierst Du wie beschrieben die passende init()-Zeile und kommentierst alle anderen aus.

Ich habe diese Library verwendet und - weil das rote für mein Display die Verschiebung nicht komplett abgestellt hat - lokal bei mir selbst eins dazugefügt (REDTAB2). Thread dazu gibt es hier auch.

Vielleicht hat az mal den Lieferanten gewechselt oder der hat was umgebaut. Das ausgerechnet GREENTAB bei einem Display mit rotem Tab funktionieren soll, kann ich eh' nicht verstehen.

Gruß Walter

Super! Vielen Dank, jetzt funktioniert es :slight_smile: