前提
Arduino IDE 2.0.1
USBケーブルでPCと接続
ST7789とArduinoはこのように接続している
VCC:3.3vのときと5vのとき両方試している
GND:GND
SCL:D13
SDA:D11
RES:D9
DC:D8
BLK:繋いでいない
使用した製品はこの商品である
https://amzn.to/3TYcgA9
発生している問題・エラーメッセージ
エラーメッセージは発生していない。
いろいろな図形などが描かれると予想しているが、全くディスプレイに反応がない。
該当のソースコード
Arduino-ST7735 and ST7789 Libraryのgraphictest_st7789.ino
に対して、オプション1、2両方とも試してみた
// For the breakout board, you can use any 2 or 3 pins. // These pins will also work for the 1.8" TFT shield. #define TFT_CS 10 #define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin #define TFT_DC 8 #endif // OPTION 1 (recommended) is to use the HARDWARE SPI pins, which are unique // to each board and not reassignable. For Arduino Uno: MOSI = pin 11 and // SCLK = pin 13. This is the fastest mode of operation and is required if // using the breakout board's microSD card. //Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); // OPTION 2 lets you interface the display using ANY TWO or THREE PINS, // tradeoff being that performance is not as fast as hardware SPI above. #define TFT_MOSI 11 // Data out #define TFT_SCLK 13 // Clock out Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
試したこと
前提条件にあるように配線を行い、graphictest_st7789.inoを書き込んだ。
質問へのコメントをもとに、コメントアウトを外す場所を確認した。しかし
下記サイトを参考にした結果、tft.inoがあり、そこでは引数が3つの関数を利用していた。
https://101010.fun/iot/arduino-tft-st7789.html
https://github.com/jumejume1/tft240x240-spi/blob/master/tft.ino
を書き込んで実行したところ、描画されるときが一度あった。
tft.inoからわかることとして
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
を利用しており、初期化には
// if the display has CS pin try with SPI_MODE0 tft.init(240, 240, SPI_MODE2); // Init ST7789 display 240x240 pixel
を使用していた。 CSピンがあればSPI_MODE0を使えと指示があるが、CSピンがないのでSPI2で良いと認識している

回答1件
あなたの回答
tips
プレビュー