/****************************************** * 0.96" Display (160x80px) ansteuern * Controller: ST7735S * 13pol. PFC 0.8mm Display Typ: RFA300960A-AYW-DNN * 8pol. PFC 0.5mm * * Einstellungen IDE: Board: "Arduino Pro or Pro Mini" * Processor: "ATmega328P (5V, 16MHz)" * Programmer: "AVRISP mkII" * * Einstellungen serielle Schnittstelle: 9600 Baud, 8N1 * * Anschluss: * D8: -> RS * D9: -> RST * D10: SS -> CS * D11: MOSI -> SDA * D13: SCK -> SCL * * PFC: Display Anschlüsse: * 1 SPI4W SPI4W=’0’, 3-wire SPI. SPI4W=’1’, 4-wire SPI. * 2 NC No connection * 5 3 SDA Serial interface data * 6 4 SCL Serial interface clock * 4 5 RS Data/command selection pin (4-wire SPI use) * 3 6 RES Reset pin (low active) * 8 7 CS Chip selection pin (low active) * 2 8 GND Ground * 9 NC No connection * 7 10 VCC Power supply (3V3) * 11 LEDK Back light cathode * 1 12 LEDA Back light anode * 13 GND Ground * * Andere Anschlüsse: * D2: DCC Signal oder Analog Vorwärts * A1: Analog Rückwärts * D5: Kontrollled * D3: Hintergrundbeleuchtung Display 1=AUS, 0=EIN * * ********************************************/ //#define DISPLAY_TYP 0 // 13pol. PFC 0.8mm #define DISPLAY_TYP 1 // 8pol. PFC 0.5mm #include #include //#include "Adafruit_ST7789.h" //#include "Adafruit_ST77xx.h" #include // DCC (-VRW) geht an Pin 2 am Arduino. Das entspricht dem Interrupt 0 am Arduino #define VRW 2 // Vorwärts #define RKW A1 // Rückwärts #define TFT_CS 10 #define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin #define TFT_DC 8 #define LED 5 // Kontrollled #define TFT_HGB 3 // Hintergrundbeleuchtung Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); void setup() { Serial.begin(9600); Serial.setTimeout(200); //Timeout auf 100ms pinMode(VRW, INPUT); pinMode(RKW, INPUT); Serial.print("Initialisiere Display..."); tft.initR(INITR_MINI160x80_PLUGIN); // Init ST7735S mini display Serial.println(" Fertig"); Serial.print("Starte Programm..."); tft.setRotation(1); tft.invertDisplay(false); tft.setTextWrap(false); // Kein Textumbruch beim scrollen Serial.print("A"); //tft.fillScreen(ST77XX_BLACK); // Hier crasht es wenn entkommentiert Serial.print("3"); tft.setTextColor(ST77XX_RED, ST77XX_BLACK); tft.setTextSize(2); tft.setCursor(0, 0); tft.println("Test"); pinMode(TFT_HGB, OUTPUT); // Hintergrundbeleuchtung // Und hier crasht es auch, wenn entkommentiert //digitalWrite(TFT_HGB, LOW); // EIN //pinMode(LED, OUTPUT); //digitalWrite(LED, LOW); // LED ausgeschaltet } void loop() { delay(1000); tft.setCursor(0, 0); tft.println("Test"); }