#include <Adafruit_GFX.h>
#include <Adafruit_ST7735.h>
#include <SPI.h>
// ST7735S display pins
#define TFT_CLK 14 // 使用可用的引脚
#define TFT_MISO -1 // 不使用MISO引脚
#define TFT_MOSI 13 // 使用可用的引脚
#define TFT_CS 15 // 使用可用的引脚
#define TFT_RST 16 // 使用可用的引脚
#define TFT_DC 2 // 使用可用的引脚
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST);
void setup() {
Serial.begin(115200);
// Initialize the display
tft.initR(INITR_BLACKTAB);
tft.setRotation(3); // Adjust rotation if needed
// Clear the screen and set text color
tft.fillScreen(ST7735_BLACK);
tft.setTextColor(ST7735_WHITE);
}
void loop() {
// Display "Hello, World!" at coordinates (10, 10)
tft.setCursor(10, 10);
tft.println("Hello, World!");
delay(2000); // Delay for 2 seconds
// Clear the screen
tft.fillScreen(ST7735_BLACK);
delay(1000); // Delay for 1 second before repeating
}
欢迎联系本站长QQ:3216572