st7735-TFT測試-點陣圖形(2)-ESP32

 

接線

(更正:
            SCL-->ESP32(D18)
           SDA-->ESP32(D23)



1.先到此下載程式庫:https://github.com/adafruit/Adafruit-ST7735-Library.git

  並上傳至ArduinoIDE的library

2.安裝Adafruit_GFX

更改腳位

選擇對應的型號

圖片更改相素

開啓舊版小畫家


取模

下載img2LCD

解壓之後,執行Img2Lcd.exe

注意:取模範圍不要超過TFT的寛和長,例如st7735-1.44吋為128x128,儘量在此範圍內




儲存好之後將"檔名.h"存入主程式同一個資料夾內

這是剛存檔好的.h檔

#ifndef BITMAPS_H
#define BITMAPS_H

const unsigned char fire [] PROGMEM =  { /* 0X00,0X04,0X50,0X00,0X50,0X00, */
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X19,0XC0,0X00,0X00,
0X03,0XB8,0X00,0X00,0X00,0X00,0X20,0X20,0X00,0X00,0X04,0X04,0X00,0X00,0X00,0X00,
0X40,0X10,0X00,0X00,0X08,0X02,0X00,0X00,0X00,0X00,0X80,0X00,0X00,0X00,0X00,0X01,
0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,
0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0XBF,0X88,0X00,0X00,0X17,0XF1,0X00,0X00,
0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,
0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,
0XB8,0X08,0X00,0X00,0X17,0X81,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,
0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,
0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0XBF,0X88,0X00,0X00,0X17,0XFD,0X00,0X00,
0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,
0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X17,0X81,0X00,0X00,0X00,0X00,
0XA8,0X08,0X00,0X00,0X17,0X81,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,
0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,
0X00,0X00,0X17,0XF1,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X17,0XF1,0X00,0X00,
0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,
0X10,0X01,0X00,0X00,0X00,0X00,0XB8,0X08,0X00,0X00,0X17,0X81,0X00,0X00,0X00,0X00,
0X80,0X08,0X00,0X00,0X17,0X81,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,
0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0XBF,0X88,
0X00,0X00,0X17,0XF9,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,
0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,
0X10,0X01,0X00,0X00,0X00,0X00,0XB8,0X08,0X00,0X00,0X17,0X81,0X00,0X00,0X00,0X00,
0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,
0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X17,0XF1,0X00,0X00,0X00,0X00,0XBF,0X88,
0X00,0X00,0X17,0XF1,0X00,0X00,0X00,0X00,0X80,0X08,0X00,0X00,0X10,0X01,0X00,0X00,
0X00,0X03,0X00,0X04,0X00,0X00,0X60,0X00,0XC0,0X00,0X00,0X04,0X00,0X03,0X00,0X00,
0XC0,0X00,0X20,0X00,0X00,0X08,0X02,0X01,0X00,0X01,0X80,0X40,0X10,0X00,0X00,0X08,
0X0A,0X80,0X80,0X01,0X00,0X40,0X10,0X00,0X00,0X10,0X07,0X00,0X40,0X02,0X00,0X40,
0X08,0X00,0X00,0X00,0X42,0X10,0X40,0X02,0X00,0X40,0X00,0X00,0X00,0X21,0X42,0X14,
0X20,0X04,0X30,0XE1,0X84,0X00,0X00,0X20,0XC2,0X18,0X20,0X04,0X1D,0XFB,0X04,0X00,
0X00,0X21,0XB2,0X6C,0X20,0X04,0X0F,0XFE,0X04,0X00,0X00,0X00,0X0A,0X80,0X20,0X04,
0X07,0XFC,0X00,0X00,0X00,0X00,0X07,0X00,0X00,0X00,0X07,0XFC,0X00,0X00,0X00,0X00,
0X0F,0X80,0X20,0X04,0X07,0XFC,0X00,0X00,0X00,0X21,0X32,0X6C,0X20,0X04,0X03,0XFC,
0X04,0X00,0X00,0X20,0XC2,0X18,0X20,0X04,0X1F,0XFF,0X04,0X00,0X00,0X21,0XC2,0X1C,
0X20,0X04,0X30,0XE1,0X84,0X00,0X00,0X00,0X42,0X10,0X40,0X02,0X00,0X40,0X00,0X00,
0X00,0X10,0X06,0X00,0X40,0X02,0X00,0X40,0X08,0X00,0X00,0X08,0X0B,0X80,0X80,0X01,
0X00,0X40,0X10,0X00,0X00,0X08,0X02,0X01,0X00,0X00,0X80,0X40,0X10,0X00,0X00,0X04,
0X00,0X03,0X00,0X00,0XC0,0X00,0X60,0X00,0X00,0X03,0X00,0X04,0X00,0X00,0X20,0X00,
0XC0,0X00,0X00,0X00,0X80,0X18,0X00,0X00,0X18,0X03,0X00,0X00,0X00,0X00,0X38,0XE0,
0X00,0X00,0X07,0X1C,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
};
#endif

主程式

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library

#include "t.h"


// For the breakout, you can use any 2 or 3 pins
// These pins will also work for the 1.8" TFT shield
#define TFT_CS     5
#define TFT_RST    4  // you can also connect this to the Arduino reset
                      // in which case, set this #define pin to 0!
#define TFT_DC     2

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);

void setup() {
  tft.initR(INITR_BLACKTAB);
  tft.setRotation(1);
  tft.fillScreen(ST7735_WHITE);

//Case 1: Monochrome Bitmaps
 
  tft.drawBitmap(0,0,fire,80,80,ST7735_BLACK); //(0,0)是位置\\(80,80)是剛設定的輸出寛和高)
//  tft.drawBitmap(0,0,semiCircle, 50, 25, ST7735_BLACK);
//  tft.drawBitmap(0,0,myBitmap, 71, 71, ST7735_CYAN);
//  tft.drawBitmap(10,0,wifi_icon, 20, 15, ST7735_WHITE);
//  tft.drawBitmap(130,0,battery_icon, 20, 15, ST7735_WHITE);
//  tft.drawBitmap(70,0,user_icon, 15, 15, ST7735_WHITE);
//  tft.drawBitmap(0,0,evive_logo, 71, 71, ST7735_CYAN);

}

void loop() {
}



留言

這個網誌中的熱門文章

ESP32-CAM燒錄出現fd_forward.h: No such file or directory錯誤信息<解決方案>