8*8点阵屏

型号:1088AS

列正,行负,则亮

TFT屏幕280x280

制作中文字库

使用platform平台添加TFT_eSPI库,

找到该库下的文件夹Create_Smooth_Font/Create_font,可以发现有两个文件夹和一个文件

data文件夹用于放置ttf结尾的字体文件

FontFiles用于放置生成的字体文件

Create_font.pde是生成字体的程序

pde文件需要使用特定的程序打开,https://processing.org/,在该网站下载对应的软件

使用该软件打开Create_font.pde,并修改部分地方

String fontName = "STHUPO";  // 字体文件名称
String fontType = ".TTF"; // 字体文件后缀,区分大小写,即.ttf、.TTF
int fontSize = 28; // 字体大小
int displayFontSize = 28; // 字体大小,建议fontSize与displayFontSize一致
static final int[] unicodeBlocks = {} // 选择编码模式
static final int[] specificUnicodes = {} // 添加需要显示的汉字

注:添加所需要汉字步骤如下:

  1. 将需要转换的汉字转为Unicode,工具网站:在线Unicode编码转换-Unicode和ASCII在线互转-中文转Unicode工具 (jsons.cn)
  2. 再将\u替换为,0x

温度 -> \u6e29\u5ea6 -> 0x6e29,0x5ea6,最后放入到specificUnicodes数组中

最后运行程序,生成vlw后缀文件,将该文件转为二进制,工具网站:File to hex converter (tomeko.net)

最后将转换后的二进制写到模板中即可

#include <pgmspace.h>
#include <Arduino.h>

const uint8_t STHUPO_28[] PROGMEM = {
// 转换后的二进制写入此
};

使用

#include <Arduino.h>
#include <TFT_eSPI.h>
#include <STHUPO_28.h>

TFT_eSPI tft = TFT_eSPI();

void setup()
{
// put your setup code here, to run once:
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE);
tft.loadFont(STHUPO_28); // 导入字体
tft.setCursor(0, 0);
tft.setTextSize(28);
tft.println("温度:");
}

void loop()
{
// put your main code here, to run repeatedly:
}