arduino中ESP8266调用.vlw字库TFT-eSPI显示

无论百度还是本站,搜索8266TFT-eSPI显示,很多都是Processing制作.h的中文字库,,因为.h文件较大,能显示的汉字不多。还在TFT-eSPI示例中就有使用调用.vlw字库的示例,在此我赘述一下。

看示例代码:

/*
  There are four different methods of plotting anti-aliased fonts to the screen.
  This sketch uses method 1, using tft.print() and tft.println() calls.
  In some cases the sketch shows what can go wrong too, so read the comments!
  The font is rendered WITHOUT a background, but a background colour needs to be
  set so the anti-aliasing of the character is performed correctly. This is because
  characters are drawn one by one.
    This method is good for static text that does not change often because changing
  values may flicker. The text appears at the tft cursor coordinates.
  It is also possible to "print" text directly into a created sprite, for example using
  spr.println("Hello"); and then push the sprite to the screen. That method is not
  demonstrated in this sketch.
  */
//  The fonts used are in the sketch data folder, press Ctrl+K to view.
//  Upload the fonts and icons to SPIFFS (must set at least 1M for SPIFFS) using the
//  "Tools"  "ESP8266 (or ESP32) Sketch Data Upload" menu option in the IDE.
//  To add this option follow instructions here for the ESP8266:
//  https://github.com/esp8266/arduino-esp8266fs-plugin
//  or for the ESP32:
//  https://github.com/me-no-dev/arduino-esp32fs-plugin
//  Close the IDE and open again to see the new menu option.
//  A processing sketch to create new fonts can be found in the Tools folder of TFT_eSPI
//  https://github.com/Bodmer/TFT_eSPI/tree/master/Tools/Create_Smooth_Font/Create_font
//  This sketch uses font files created from the Noto family of fonts:
//  https://www.google.com/get/noto/

#define AA_FONT_SMALL "NotoSansBold15"
#define AA_FONT_LARGE "NotoSansBold36"
// Font files are stored in SPIFFS, so load the library
#include <FS.h>
#include <SPI.h>
#include <TFT_eSPI.h>       // Hardware-specific library
TFT_eSPI tft = TFT_eSPI();

void setup(void) {
  Serial.begin(250000);
  tft.begin();
  tft.setRotation(0);
  if (!SPIFFS.begin()) {
    Serial.println("SPIFFS initialisation failed!");
    while (1) yield(); // Stay here twiddling thumbs waiting
  }
  Serial.println("\r\nSPIFFS available!");
  
  // ESP32 will crash if any of the fonts are missing
  bool font_missing = false;
  if (SPIFFS.exists("/NotoSansBold15.vlw")    == false) font_missing = true;
  if (SPIFFS.exists("/NotoSansBold36.vlw")    == false) font_missing = true;
  if (font_missing)
  {
    Serial.println("\r\nFont missing in SPIFFS, did you upload it?");
    while(1) yield();
  }
  else Serial.println("\r\nFonts found OK.");
}

void loop() {
  tft.fillScreen(TFT_BLACK);
  tft.setTextColor(TFT_WHITE, TFT_BLACK); 
  tft.setCursor(0, 0); // Set cursor at top left of screen

  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  // Small font
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  tft.loadFont(AA_FONT_SMALL); // Must load the font first

  tft.println("Small 15pt font"); // println moves cursor down for a new line
  tft.println(); // New line
  tft.print("ABC"); // print leaves cursor at end of line
  tft.setTextColor(TFT_CYAN, TFT_BLACK);
  tft.println("1234"); // Added to line after ABC
  tft.setTextColor(TFT_YELLOW, TFT_BLACK);
  // print stream formatting can be used,see:
  // https://www.arduino.cc/en/Serial/Print
  int ivalue = 1234;
  tft.println(ivalue);       // print as an ASCII-encoded decimal
  tft.println(ivalue, DEC);  // print as an ASCII-encoded decimal
  tft.println(ivalue, HEX);  // print as an ASCII-encoded hexadecimal
  tft.println(ivalue, OCT);  // print as an ASCII-encoded octal
  tft.println(ivalue, BIN);  // print as an ASCII-encoded binary

  tft.println(); // New line
  tft.setTextColor(TFT_MAGENTA, TFT_BLACK);
  float fvalue = 1.23456;
  tft.println(fvalue, 0);  // no decimal places
  tft.println(fvalue, 1);  // 1 decimal place
  tft.println(fvalue, 2);  // 2 decimal places
  tft.println(fvalue, 5);  // 5 decimal places

  delay(5000);

  // Get ready for the next demo while we have this font loaded
  tft.fillScreen(TFT_BLACK);
  tft.setCursor(0, 0); // Set cursor at top left of screen
  tft.setTextColor(TFT_WHITE, TFT_BLACK);
  tft.println("Wrong and right ways to");
  tft.println("print changing values...");
  tft.unloadFont(); // Remove the font to recover memory used

  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  // Large font
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  tft.loadFont(AA_FONT_LARGE); // Load another different font
  //tft.fillScreen(TFT_BLACK);
  
  // Draw changing numbers - does not work unless a filled rectangle is drawn over the old text
  for (int i = 0; i <= 20; i++)
  {
    tft.setCursor(50, 50);
    tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only
                                           // By default background fill is off
    tft.print("      "); // Overprinting old number with spaces DOES NOT WORK!
    tft.setCursor(50, 50);
    tft.print(i / 10.0, 1);
    // Adding a parameter "true" to the setTextColor() function fills character background
    // This extra parameter is only for smooth fonts!
    tft.setTextColor(TFT_GREEN, TFT_BLACK, true);
    tft.setCursor(50, 90);
    tft.print(i / 10.0, 1);
    
    delay (200);
  }
  delay(5000);
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  // Large font text wrapping
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  tft.fillScreen(TFT_BLACK);
    tft.setTextColor(TFT_YELLOW, TFT_BLACK); // Change the font colour and the background colour
  tft.setCursor(0, 0); // Set cursor at top left of screen
  tft.println("Large font!");
  tft.setTextWrap(true); // Wrap on width
  tft.setTextColor(TFT_CYAN, TFT_BLACK);
  tft.println("Long lines wrap to the next line");
  tft.setTextWrap(false, false); // Wrap on width and height switched off
  tft.setTextColor(TFT_MAGENTA, TFT_BLACK);
  tft.println("Unless text wrap is switched off");
  tft.unloadFont(); // Remove the font to recover memory used
  delay(8000);
}

使用Processing运行TFT-eSPI库自带工具Creat-font.pde,下载Processing

链接: https://pan.baidu.com/s/1X4AE2JZikcKgM5JciaXLPg?pwd=atax 提取码: atax 

把想抽取的字体文件放在data文件夹内,例如我把楷体-GB2312.ttf

改成英文名lee4.ttf,改一下Creat-font.pde中字体名称、字体大小、显示字体大小,

想要显示汉字,需要汉字的Unicode编码,使用在线中文转Unicode工具
http://www.jsons.cn/unicode/

输入需要转换的文本,可以7000个字一起,也可以3000字,

7000字链接: https://pan.baidu.com/s/1RQIqvDZP31i3BbM0xoBWBQ?pwd=3ccx 提取码: 3ccx

3000字链接: https://pan.baidu.com/s/1soCD38PvnlXQ8HelShNr1Q?pwd=bgnd 提取码: bgnd 

Unicode编码复制后将 \u,替换为,0x,C语言的16进制格式,黏贴在Creat-font.pde中

static final int[] specificUnicodes = {0x5148,0x5e1d……}

点击左上角的运行按钮,稍等片刻,在FontFiles文件夹生成新的lee416.vlw文件,就是这个了!

arduino准备工作:下载ESP8266FS-0.5.0.zip,解压后放在arduino-文件-首选项-项目文件夹位置下C:\Users\Administrator\Documents\Arduino(位置不一定一样),arduino关掉重启后,工具中就多了ESP8266 Sketch Data  Upload,就可以在FLASH中上传文件了。以上形成的.vlw字库文件放在arduino的项目.ino文件目录下的data文件内。

ESP8266FS-0.5.0.zip下载链接: https://pan.baidu.com/s/10qfYcniW21KneruwJNQgCQ?pwd=h34r 提取码: h34r 拿走不谢,CDSN上有人下载还要积分,免费的资源你要啥积分!

继续上代码,我的代码是使用巴法云推送消息到8266,显示到TFT1.44LCD上,3000字的.vlw字库文件不到800K,字库再大就8266就拖不动了,3000字的还可以运行。希望有大神破解一下。

#define LEE_FONT "lee416"
// Font files are stored in SPIFFS, so load the library
#include <FS.h>
#include <SPI.h>
#include <TFT_eSPI.h>       // Hardware-specific library
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include <ESP8266httpUpdate.h>

TFT_eSPI tft = TFT_eSPI();
TFT_eSprite clk = TFT_eSprite(&tft);
//巴法在线升级.bin文件URL
String upUrl = "http://bin.bemfa.com/b/****************=xiaodu002.bin";

String smart_data = "";
int size_data = 0; //WIFI数据长度
String wifiname;
String wifipsw;
bool flag; //读取EEPROM联网,是否成功标志位
int wifiname_len; // wifi名的长度

#define server_ip "bemfa.com" //巴法云服务器地址默认即可
#define server_port "8344" //服务器端口,tcp创客云端口8344

//********************需要修改的部分*******************//

//#define wifi_name  "****"     //WIFI名称,区分大小写,不要写错
//#define wifi_password   "****"  //WIFI密码
String UID = "*******";  //用户私钥,可在控制台获取,修改为自己的UID
String TOPIC = "****";         //主题名字,可在控制台新建

//**************************************************//
//最大字节数
#define MAX_PACKETSIZE 512
//设置心跳值60s
#define KEEPALIVEATIME 60*1000
//tcp客户端相关初始化,默认即可
WiFiClient TCPclient;
String TcpClient_Buff = "";//初始化字符串,用于接收服务器发来的数据
unsigned int TcpClient_BuffIndex = 0;
unsigned long TcpClient_preTick = 0;
unsigned long preHeartTick = 0;//心跳
unsigned long preTCPStartTick = 0;//连接
bool preTCPConnected = false;
String getMsg = "";//巴法推送获取消息
int bri=2; //调整显示行数


//相关函数初始化
//连接WIFI
void doWiFiTick();
void startSTA();

//TCP初始化连接
void doTCPClientTick();
void startTCPClient();
void sendtoTCPServer(String p);



void Config_wifi(const char *wifiname, const char *psw) //Config WiFi
{
  int i = 0;
  WiFi.begin(wifiname, psw);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    if (i == 0)
    {
      Serial.print("being WiFi Config...");
    }
    Serial.print(".");
    i++;
    if (i == 15)
    {
      Serial.println("Connect failed,Please Config with APP SmartConfig.");
      flag = true;
      break;
    }
  }
  if (WiFi.isConnected())
  {
    
    Serial.println("网络连接成功");
    //Serial.print("Local IP:");
    //Serial.println(WiFi.localIP());
  }
}
void read_eeprom()//读取eeprom中的数据连接WiFi
{
  wifiname = "";
  wifipsw = "";
  int a = (int(EEPROM.read(0)) - int('0')) * 10 + (int(EEPROM.read(1)) - int('0')); //读数据,地址0和地址1分别保存wifi名称的长度的十位和个位
  int b = (int(EEPROM.read(2)) - int('0')) * 10 + (int(EEPROM.read(3)) - int('0')) ; //读数据,地址2和地址3分别保存wifi密码的长度的十位和个位
  Serial.println();
  Serial.println(a);//打印出wifi名的长度,看是否正确
  Serial.println(b);//打印出整个保存在eeprom中字符串的长度
  for (int addr = 4; addr < b + 1; addr++)//地址3开始则是wifi的名称,然后依次是wifi密码
  {
    int data = EEPROM.read(addr); //读数据
    // Serial.print(char(data));
    if (addr < a + 4)
    {
      wifiname = wifiname + char(data);
    }
    else
    {
      wifipsw = wifipsw + char(data);
    }
    delay(2);
  }
  Serial.print("SSID:");
  Serial.println(wifiname);
  Serial.print("PASSWORD:");
  Serial.println(wifipsw);

}
void smartConfig()//可以使用安信可AirKiss配网
{
  WiFi.mode(WIFI_STA);
  Serial.println("\r\nWait for Smartconfig");
  delay(2000);
  // 等待配网
  WiFi.beginSmartConfig();

  while (1)
  {
    Serial.print(".");
    delay(500);
    if (WiFi.smartConfigDone())
    { 
      //Serial.println("SmartConfig Success");
      //Serial.printf("SSID:%s\r\n", WiFi.SSID().c_str());
      //Serial.printf("PSW:%s\r\n", WiFi.psk().c_str());
      WiFi.setAutoConnect(true);  // 设置自动连接


      wifiname_len = String(WiFi.SSID().c_str()).length(); //获取wifi名的长度
      
      if (wifiname_len < 9) {//判断wifi名是否为个位数,是则在前面补零
        smart_data = String("0") + String(wifiname_len) + String(size_data) + String (WiFi.SSID().c_str()) + String(WiFi.psk().c_str());
        size_data = String(smart_data).length();
        smart_data = String("0") + String(wifiname_len) + String(size_data) + String (WiFi.SSID().c_str()) + String(WiFi.psk().c_str());
      } else {
        smart_data = String(wifiname_len) + String(size_data) + String (WiFi.SSID().c_str()) + String(WiFi.psk().c_str());
        size_data = String(smart_data).length();
        smart_data = String(wifiname_len) + String(size_data) + String (WiFi.SSID().c_str()) + String(WiFi.psk().c_str());
      }
      Serial.println(size_data);
      Serial.println(smart_data); //打印出保存在eeprom数据
      Serial.println(String(smart_data).length());//打印出保存在eeprom中的数据长度
      for (int addr = 0; addr < size_data + 1; addr++)
      {
        //int data = addr%256; //在该代码中等同于int data = addr;因为下面write方法是以字节为存储单位的.
        //String(smart_data).charAt(addr);
        EEPROM.write(addr, toascii(String(smart_data).charAt(addr))); //写数据
      }
      EEPROM.commit(); //保存更改的数据

      Serial.println("End write");
      break;
    }
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

/*发送数据到TCP服务器 */
void sendtoTCPServer(String p){
  if (!TCPclient.connected()) 
  {
    Serial.println("Client is not readly");
    return;
  }
  TCPclient.print(p);
  preHeartTick = millis();//心跳计时开始,需要每隔60秒发送一次数据
}


/*初始化和服务器建立连接*/
void startTCPClient(){
  if(TCPclient.connect(server_ip, atoi(server_port))){
    Serial.print("\nConnected to server:");
    Serial.printf("%s:%d\r\n",server_ip,atoi(server_port));
    
    String tcpTemp="";  //初始化字符串
    tcpTemp = "cmd=1&uid="+UID+"&topic="+TOPIC+"\r\n"; //构建订阅指令
    sendtoTCPServer(tcpTemp); //发送订阅指令
    tcpTemp="";//清空
    /*
     //如果需要订阅多个主题,可发送  cmd=1&uid=xxxxxxxxxxxxxxxxxxxxxxx&topic=xxx1,xxx2,xxx3,xxx4\r\n
    教程:https://bbs.bemfa.com/64
     */
    
    preTCPConnected = true;
    TCPclient.setNoDelay(true);
  }
  else{
    Serial.print("Failed connected to server:");
    Serial.println(server_ip);
    TCPclient.stop();
    preTCPConnected = false;
  }
  preTCPStartTick = millis();
}

void showstr()//TFTLCD显示getMsg内容
{ clk.setColorDepth(8);
  clk.loadFont(LEE_FONT);//加载字体
  clk.createSprite(128,22); //创建Sprite大小128*22
  clk.fillSprite(0x0000);//填充黑色
  clk.setTextDatum(ML_DATUM);
  clk.setTextColor(0xFDA0,0x0000); //显示字体颜色
  clk.drawString(getMsg,1,11);//推送文本
  clk.pushSprite(2,bri);//在x=2,y=bri位置显示
  clk.deleteSprite();卸载Sprite
  clk.unloadFont();//释放字库
    /*tft.setTextColor(TFT_YELLOW); //设置字体颜色
    tft.loadFont(ZdyLwFont_20);     //设定我们制作的华光准圆的字体
    tft.setCursor(3,bri);       //设置光标位置
    tft.println(getMsg);     //打印文字   
    tft.unloadFont();             //释放字库,节省RAM
*/
  bri=bri+21;//y+21,换行
  if(bri>115)
  {bri=2;}

}

/*检查数据,发送心跳*/
void doTCPClientTick(){
 //检查是否断开,断开后重连
   if(WiFi.status() != WL_CONNECTED) return;
  if (!TCPclient.connected()) {//断开重连
  if(preTCPConnected == true){
    preTCPConnected = false;
    preTCPStartTick = millis();
    Serial.println();
    Serial.println("TCP Client disconnected.");
    TCPclient.stop();
  }
  else if(millis() - preTCPStartTick > 1*1000)//重新连接
    startTCPClient();
  }
  else
  {
    if (TCPclient.available()) {//收数据
      char c =TCPclient.read();
      TcpClient_Buff +=c;
      TcpClient_BuffIndex++;
      TcpClient_preTick = millis();
      
      if(TcpClient_BuffIndex>=MAX_PACKETSIZE - 1){
        TcpClient_BuffIndex = MAX_PACKETSIZE-2;
        TcpClient_preTick = TcpClient_preTick - 200;
      }
 
    }
    if(millis() - preHeartTick >= KEEPALIVEATIME){//保持心跳
      preHeartTick = millis();
      Serial.println("--Keep alive:");
      sendtoTCPServer("ping\r\n"); //发送心跳,指令需\r\n结尾,详见接入文档介绍
    }
  }
  if((TcpClient_Buff.length() >= 1) && (millis() - TcpClient_preTick>=200))
  {
    TCPclient.flush();
    Serial.print("Rev string: ");
    TcpClient_Buff.trim(); //去掉首位空格
    Serial.println(TcpClient_Buff); //打印接收到的消息
    String getTopic = "";
    
    if(TcpClient_Buff.length() > 15){//注意TcpClient_Buff只是个字符串,在上面开头做了初始化 String TcpClient_Buff = "";
          //此时会收到推送的指令,指令大概为 cmd=2&uid=xxx&topic=light002&msg=off
          int topicIndex = TcpClient_Buff.indexOf("&topic=")+7; //c语言字符串查找,查找&topic=位置,并移动7位,不懂的可百度c语言字符串查找
          int msgIndex = TcpClient_Buff.indexOf("&msg=");//c语言字符串查找,查找&msg=位置
          getTopic = TcpClient_Buff.substring(topicIndex,msgIndex);//c语言字符串截取,截取到topic,不懂的可百度c语言字符串截取
          getMsg = TcpClient_Buff.substring(msgIndex+5);//c语言字符串截取,截取到消息
       
          Serial.print("topic:");
          Serial.println(getTopic); //打印截取到的主题值
          Serial.print("msg:");
          Serial.println(getMsg);   //打印截取到的消息值
   
   showstr();
  //if(getMsg.indexOf("end"))bri=5;
    
   
   if(getMsg == "update")
   {  //如果收到指令update
      updateBin();//执行升级函数
    }
   }

   TcpClient_Buff="";
   TcpClient_BuffIndex = 0;
  }
}
/*



/**************************************************************************
                                 WIFI
***************************************************************************/
/*
  WiFiTick
  检查是否需要初始化WiFi
  检查WiFi是否连接上,若连接成功启动TCP Client
  控制指示灯
*/
void doWiFiTick(){
 // static bool startSTAFlag = false;
  static bool taskStarted = false;
  static uint32_t lastWiFiCheckTick = 0;

 //未连接1s重连
  if ( WiFi.status() != WL_CONNECTED ) {
    if (millis() - lastWiFiCheckTick > 1000) {
      lastWiFiCheckTick = millis();
    }
  }
  //连接成功建立
  else {
    if (taskStarted == false) {
      taskStarted = true;
      Serial.print("\r\nGet IP Address: ");
      Serial.println(WiFi.localIP());
      startTCPClient();
    }
  }
}

//当升级开始时,打印日志
void update_started() {
  Serial.println("CALLBACK:  HTTP update process started");
}

//当升级结束时,打印日志
void update_finished() {
  Serial.println("CALLBACK:  HTTP update process finished");
}

//当升级中,打印日志
void update_progress(int cur, int total) {
  Serial.printf("CALLBACK:  HTTP update process at %d of %d bytes...\n", cur, total);
}

//当升级失败时,打印日志
void update_error(int err) {
  Serial.printf("CALLBACK:  HTTP update fatal error code %d\n", err);
}

/**
 * 固件升级函数
 * 在需要升级的地方,加上这个函数即可,例如setup中加的updateBin(); 
 * 原理:通过http请求获取远程固件,实现升级
 */
void updateBin(){
  Serial.println("Try to Start Update");    
  WiFiClient UpdateClient;

  ESPhttpUpdate.onStart(update_started);//当升级开始时
  ESPhttpUpdate.onEnd(update_finished); //当升级结束时
  ESPhttpUpdate.onProgress(update_progress); //当升级中
  ESPhttpUpdate.onError(update_error); //当升级失败时

  t_httpUpdate_return ret = ESPhttpUpdate.update(UpdateClient, upUrl);
  switch(ret) {
    case HTTP_UPDATE_FAILED:      //当升级失败
        Serial.println("[update] Update failed.");
        break;
    case HTTP_UPDATE_NO_UPDATES:  //当无升级
        Serial.println("[update] Update no Update.");
        break;
    case HTTP_UPDATE_OK:         //当升级成功
        Serial.println("[update] Update ok.");
        break;
  }
}

// 初始化,相当于main 函数
void setup() 
{ Serial.begin(250000);
   if (!SPIFFS.begin()) {
    Serial.println("SPIFFS initialisation failed!");
    while (1) yield(); // Stay here twiddling thumbs waiting
  }
  Serial.println("\r\nSPIFFS available!");
  
  // ESP32 will crash if any of the fonts are missing
  bool font_missing = false;
  if (SPIFFS.exists("/lee416.vlw")    == false) font_missing = true;
  //if (SPIFFS.exists("/NotoSansBold36.vlw")    == false) font_missing = true;

  if (font_missing)
  {
    Serial.println("\r\nFont missing in SPIFFS, did you upload it?");
    while(1) yield();
  }
  else Serial.println("\r\nFonts found OK."); 

  //pinMode(LED_Pin,OUTPUT);
  //digitalWrite(LED_Pin,HIGH);
  Serial.println("Beginning...");
  EEPROM.begin(50); //
  flag = false;
  read_eeprom();
  Config_wifi(wifiname.c_str(), wifipsw.c_str());
  if (flag)
  {
    smartConfig();
  }
 tft.begin(); /* TFT init */
 //tft.invertDisplay(1);//反转所有显示颜色:1反转,0正常
 tft.fillScreen(0x0000);
 tft.setTextColor(0x001F);
         // 设置屏幕显示的旋转角度,参数为:0, 1, 2, 3
        // 分别代表 0°、90°、180°、270°
        //根据实际需要旋转
 tft.setRotation(4); 
 tft.loadFont(LEE_FONT); // Must load the font first
 tft.setCursor(30, 10);       //设置光标位置
 tft.println("大家好!");     //打印文字
 tft.setCursor(10, 45);       //设置光标位置
 tft.println("这是中文字体");   //打印文字
 tft.setCursor(15, 85);       //设置光标位置
 tft.println("李四爱生活");   //打印文字  
 tft.unloadFont();             //释放字库,节省RAM
}

//循环
void loop() {
  doWiFiTick();
  doTCPClientTick();
}

显示效果,巴法云推送消息:

  • 7
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值