Hi David,
it is working now. Yesterday before I asked I almost had it right except for that I had changed the value in tft.init(240, 240, SPI_MODE2) to mode 0 and afterwards (when I had wired it correctly) did not set it back to mode 2. I am currently using it with an ultrasonic device to measure distance. Here's the main code for the display:
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h> // Arduino SPI library
#define TFT_CS 10 // define chip select pin
#define TFT_DC 9 // define data/command pin
#define TFT_RST 8 // define reset pin, or set to -1 and connect to Arduino RESET pin
// Initialize Adafruit ST7789 TFT library
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
int distance;
[...]
void setup() {
[...]
tft.init(240, 240, SPI_MODE2);tft.setRotation(2);
tft.fillScreen(ST77XX_BLUE);
}
void testdrawtext(int text, uint16_t color, uint8_t size,char *text2) {
tft.setCursor(0, 0);
tft.setTextColor(color);
tft.setTextSize(size);
tft.setTextWrap(true);
tft.print(text);
tft.print(text2);
}
[...]
void loop() {
[...]
tft.fillScreen(ST77XX_BLUE);
testdrawtext(distance, ST77XX_WHITE,6,"cm");}
[...]
}
and the wiring as you said (instead of #11 and #13 use D75, D76 i.e. MOSI (SDA), SCK), rest as in the simple-circuit.com link above.
Thanks for you help, David!
also thanks to ard_newbie for the links
step1