Ein TFT Display ist im Gegensatz LCD Displays vielseitiger aber auch schwieriger zu programmieren. Kannst du auf einem LCD Display lediglich Buchstaben und Zahlen darstellen, sind auf einem TFT Formen, Farben und sogar Bilder möglich. Auf dieser Seite zeige ich dir wie du mit Ardublock solche TFT Displays programmieren kannst.
Anschluss des Displays an den Arduino
HEADER:
- #include <Adafruit_GFX.h>
- #include <Adafruit_ST7735.h>
- #include <SPI.h>
- #define TFT_CS 10
- #define TFT_RST 8
- #define TFT_DC 9
- Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
SETUP
- tft.initR(INITR_BLACKTAB);
- tft.fillScreen(ST7735_BLACK);
LOOP
- tft.setCursor(0, 40);
- tft.setTextColor(ST7735_WHITE);
- tft.setTextSize(3);
- tft.setTextWrap(true);
- tft.print("HALLO");
- tft.invertDisplay(false);
- tft.invertDisplay(true);
- tft.drawFastHLine(20, 20, tft.height(), ST7735_RED);
- tft.drawFastVLine(20, 20, tft.height(), ST7735_RED);
- tft.drawLine(10,15, 0, 100, ST7735_RED);
- tft.drawRect(25, 10, 78, 60, ST7735_WHITE);
- tft.fillRect(25, 10, 78, 60, ST7735_WHITE);
- tft.fillCircle(10, 10, 30, ST7735_WHITE);
- tft.drawCircle(10, 10, 30, ST7735_WHITE);
- tft.fillTriangle(42, 20, 42, 60, 90, 40, ST7735_RED);
- tft.drawTriangle(42, 20, 42, 60, 90, 40, ST7735_RED);
- tft.drawRoundRect(25, 10, 78, 60, 8, ST77XX_WHITE);
- tft.fillRoundRect(25, 10, 78, 60, 20, ST77XX_WHITE);