当前位置: 首页 > news >正文

做网站网关备案seo 优化是什么

做网站网关备案,seo 优化是什么,wordpress日期调用,邮箱格式怎么写ArduinoTFTLCD应用 ArduinoTFTLCD应用硬件连接软件导入库显示数字、字符显示汉字方案1方案2 显示图片 总结 ArduinoTFTLCD应用 对于手工喜欢DIY的人来说,Arduino驱动的TFTLCD被很多人使用,此处就总结一下,使用的是VScode的PlatformIO插件驱动…

ArduinoTFTLCD应用

  • ArduinoTFTLCD应用
    • 硬件连接
    • 软件
      • 导入库
      • 显示数字、字符
      • 显示汉字
        • 方案1
        • 方案2
      • 显示图片
    • 总结

ArduinoTFTLCD应用

对于手工喜欢DIY的人来说,Arduino驱动的TFTLCD被很多人使用,此处就总结一下,使用的是VScodePlatformIO插件驱动的Arduino,芯片使用的是ESP32

硬件连接

这里采用的是10PIN的ST7789驱动的TFTLCD屏幕,是硬件SPI驱动的。

        TFTLCD硬件管脚
在这里插入图片描述
        ESP32硬件管脚
在这里插入图片描述
我们连接的是ESP32的HSPI引脚。

功能TFTLCD引脚ESP32引脚
数据输出MOSI13
时钟SCLK14
片选CS15
选择端口DC2
复位引脚RST4
背光正BL12
电源地GNDGND
背光负GNDGND
电压正VCCVCC

有些SPI是这样标注的,引脚都是一样的。

字符1字符2功能
CSCS片选,低电平使能
DCRS数据/命令选择端口,DC端口为低时,写入的是命令;为高时,写入的是数据
RSTRESET复位信号,低电平复位
MISOSDA从设备数据输出
MOSISDI主设备数据输出
SCLKSCL时钟,由主设备发出

按照如图所示进行硬件连接。

软件

        使用的是VScodePlatformIO插件驱动的Arduino,芯片使用的是ESP32

导入库

        安装TFT_eSPI:TFT_eSPI 是一个用于 ESP32 和 ESP8266 上的基于图形显示控制器的开源软件库。它提供了一种简单且高效的方式来与 TFT LCD 显示器进行交互并创建令人惊叹的图形界面。

在左侧文件目录中\.pio\libdeps\esp32dev\TFT_eSPI\User_Setup.h文件中。

驱动要选择

// Only define one driver, the other ones must be commented out
//#define ILI9341_DRIVER       // Generic driver for common displays
//#define ILI9341_2_DRIVER     // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
//#define ST7735_DRIVER      // Define additional parameters below for this display
//#define ILI9163_DRIVER     // Define additional parameters below for this display
//#define S6D02A1_DRIVER
//#define RPI_ILI9486_DRIVER // 20MHz maximum SPI
//#define HX8357D_DRIVER
//#define ILI9481_DRIVER
//#define ILI9486_DRIVER
//#define ILI9488_DRIVER     // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define ST7789_DRIVER      // Full configuration option, define additional parameters below for this display
//#define ST7789_2_DRIVER    // Minimal configuration option, define additional parameters below for this display
//#define R61581_DRIVER
//#define RM68140_DRIVER
//#define ST7796_DRIVER
//#define SSD1351_DRIVER
//#define SSD1963_480_DRIVER
//#define SSD1963_800_DRIVER
//#define SSD1963_800ALT_DRIVER
//#define ILI9225_DRIVER
//#define GC9A01_DRIVER

屏幕尺寸

// For ST7789, ST7735, ILI9163 and GC9A01 ONLY, define the pixel width and height in portrait orientation
// #define TFT_WIDTH  80
// #define TFT_WIDTH  128
// #define TFT_WIDTH  172 // ST7789 172 x 320
// #define TFT_WIDTH  170 // ST7789 170 x 320
#define TFT_WIDTH  240 // ST7789 240 x 240 and 240 x 320
// #define TFT_HEIGHT 160
// #define TFT_HEIGHT 128
// #define TFT_HEIGHT 240 // ST7789 240 x 240
#define TFT_HEIGHT 320 // ST7789 240 x 320
// #define TFT_HEIGHT 240 // GC9A01 240 x 240

IO口

// For ESP32 Dev board (only tested with GC9A01 display)
// The hardware SPI can be mapped to any pins
#define TFT_MOSI 13 // In some display driver board, it might be written as "SDA" and so on.
#define TFT_SCLK 14
#define TFT_CS   15  // Chip select control pin
#define TFT_DC   2  // Data Command control pin
#define TFT_RST  4  // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL   12  // LED back-light

其他不做修改。

main.app文件中。导入头文件在这里插入代码片#include <TFT_eSPI.h>

#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI(); // 创建TFT对象
void setup()
{Serial.begin(115200);tft.init();                // 初始化// tft.fillScreen(TFT_BLACK); // 设置屏幕背景颜色// analogWrite(BLK, 150);     // 调节屏幕亮度,0最亮,255最暗
}
void loop() {}

显示数字、字符

tft.setTextColor(TFT_WHITE, TFT_BLACK); // 参数1:字体颜色,参数2:背景色tft.setTextFont(2); // 字体大小16*16
tft.println("Hello,world");
tft.drawString("I want to eat something", 0, 50, 2);tft.setTextFont(4); // 字体大小26*26
tft.drawNumber(1234, 0, 70);
tft.drawFloat(3.14159, 5, 0, 90);

显示汉字

方案1

利用OLED显示汉字方法,去驱动TFTLCD显示汉字。利用PCtoLCD2002.exe进行取模,然后导入文件中,利用点阵进行显示。如图所示取模方式。
在这里插入图片描述

新建文件Chinese_32.h并导入数组。

/***************************16*16的点阵字体取模方式:共阴——列行式——逆向输出*********/
unsigned char character[] = "第二一三四五";
uint8_t F16x16[] ={0x08, 0x04, 0x93, 0x92, 0x96, 0x9A, 0x92, 0xFA, 0x94, 0x93, 0x92, 0x96, 0xFA, 0x02, 0x02, 0x00,0x40, 0x40, 0x47, 0x24, 0x24, 0x14, 0x0C, 0xFF, 0x04, 0x04, 0x24, 0x44, 0x24, 0x1C, 0x00, 0x00, // 第",0/* (16 X 16 , 宋体 )*/0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00,0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, // 二",2/* (16 X 16 , 宋体 )*/0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 一",1/* (16 X 16 , 宋体 )*/0x00, 0x04, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x04, 0x00, 0x00,0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, // 三",3/* (16 X 16 , 宋体 )*/0x00, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0x00, 0x00,0x00, 0x7F, 0x28, 0x24, 0x23, 0x20, 0x20, 0x20, 0x20, 0x21, 0x22, 0x22, 0x22, 0x7F, 0x00, 0x00, // 四",4/* (16 X 16 , 宋体 )*/0x00, 0x02, 0x42, 0x42, 0x42, 0xC2, 0x7E, 0x42, 0x42, 0x42, 0x42, 0xC2, 0x02, 0x02, 0x00, 0x00,0x40, 0x40, 0x40, 0x40, 0x78, 0x47, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x40, 0x40, 0x40, 0x00, // 五",5/* (16 X 16 , 宋体 )*/
};

在main.app函数

#include <TFT_eSPI.h>
#include "Chinese_32.h"TFT_eSPI tft = TFT_eSPI(); // 创建TFT对象
#include <TJpg_Decoder.h>#define BLK 5 // 亮度控制引脚//--------------------------------------------------------------
// Prototype      : void OLED_ShowCN(unsigned char x, unsigned char y, unsigned char N)
// Calls          :
// Parameters     : x,y -- 起始点坐标(x:0~127, y:0~7); N:汉字在codetab.h中的索引
// Description    : 显示codetab.h中的汉字,16*16点阵
//--------------------------------------------------------------// 显示汉字
void OLED_ShowCN(uint8_t x, uint8_t y, uint8_t no)
{uint8_t t, j;uint16_t k;for (t = 0; t < 16; t++){k = F16x16[no * 32 + t];for (j = 0; j < 8; j++){if ((k >> j) & 0x01)tft.drawPixel(x + t, y + j, TFT_WHITE);}}for (t = 0; t < 16; t++){k = F16x16[no * 32 + 16 + t];for (j = 0; j < 8; j++){if ((k >> j) & 0x01)tft.drawPixel(x + t, y + j + 8, TFT_WHITE);}}
}uint8_t OLED_findoneCN(uint8_t ch1, uint8_t ch2, uint8_t ch3)
{uint8_t j = 0;while (character[j] != '\0'){if (ch1 == character[j] && ch2 == character[j + 1] && ch3 == character[j + 2])return j / 3 + 1;j += 3;}return 0;
}void OLED_Show(unsigned char x, unsigned char y, char ch[])
{int j = 0, k;while (ch[j] != '\0'){Serial.println(ch[j]);if (ch[j] > 0x80) // 汉字{k = OLED_findoneCN(ch[j], ch[j + 1], ch[j + 2]);if (k != 0)OLED_ShowCN((j / 3 * 2) * 8 + x, y, k - 1);j += 3;}else // ASCLL{tft.drawString((String)ch[j], (j / 3 * 2) * 8 + x, y, 2);j++;}}
}void TFT_Init()
{tft.init();                // 初始化// tft.fillScreen(TFT_BLACK); // 设置屏幕背景颜色// analogWrite(BLK, 150);     // 调节屏幕亮度,0最亮,255最暗
}void TFT_Display()
{tft.setTextColor(TFT_WHITE, TFT_BLACK); // 参数1:字体颜色,参数2:背景色tft.setTextFont(2); // 字体大小16*16tft.println("Hello,world");tft.drawString("I want to eat something", 0, 50, 2);tft.setTextFont(4); // 字体大小26*26tft.drawNumber(1234, 0, 70);tft.drawFloat(3.14159, 5, 0, 90);tft.setTextColor(TFT_WHITE, TFT_BLACK); // 参数1:字体颜色,参数2:背景色OLED_Show(0, 120, (char*)"第二一三四五");
}void setup()
{Serial.begin(115200);TFT_Init();TFT_Display();
}void loop() {}

如图所示结果。
在这里插入图片描述

方案2

        导入字库。

  1. 目录\.pio\libdeps\esp32dev\TFT_eSPI\Tools\Create_Smooth_Font文件下有三个文件。
    其中Create_font.pde:代码,通过该代码来制作字库文件。
    FontFiles : 存放我们制作出来的字库文件,制作出来后是vlw结尾的。
    data : 存放我们的字体文件,用ttf结尾的。
  2. 去https://processing.org/ 下载processing软件(资料中都放有)。
  3. 去自己的电脑中C:\Windows\Font文件中找到你想要的字体,放到data文件夹下。
  4. 在https://www.osgeo.cn/app/sa906网站中,将需要转化的汉字转成unicode编码,然后将\u转化成0x
  5. 使用processing打开Create_font.pde文件。
  6. 修改以下内容:将需要转化的的汉字的unicode编码放到specificUnicodes 数组中。
    String fontName = "simkai";  // 你的字库的文件名字。 在130行
    String fontType = ".ttf";
    //String fontType = ".otf";// Define the font size in points for the TFT_eSPI font file
    int  fontSize = 20;
    // Font size to use in the Processing sketch display window that pops up (can be different to above)
    int displayFontSize = 20;
    static final int[] unicodeBlocks = {//0x0030, 0x0039, //Example custom range (numbers 0-9)//0x0041, 0x005A, //Example custom range (Upper case A-Z)//0x0061, 0x007A, //Example custom range (Lower case a-z)
    };
    static final int[] specificUnicodes = {
    0x56e0,0x6709,0x7740,0x4f60,0x8ddf,0x5728,0x4e00,0x8d77,0x6211,0x7231,0x683e,0x8c46,0x5f20,0x5b66,0x806a
    };
    
  7. 点击运行,正确的话会弹出一个对话框,然后会在FontFiles 文件夹中生成一个.h的字库。
  8. 将生成的字库文件放入src文件夹中。
  9. 然后在主函数中:
    #include "KT_20_A.h"		//导入字库。
    tft.loadFont(KT_20_A); 		//指定tft屏幕对象载入font_12字库,KT_20_A为生成字库的数组名字。
    tft.drawString("武汉",0,0) 	//在坐标0,0位置处写武汉2个字,就可以在tft显示出来了。
    tft.unloadFont(); 			//释放字库文件,节省资源。
    

显示图片

  1. Image2Lcd打开一张BMP或者JPG格式的图片。
  2. 设置成如图所示,点击保存,注意输出图像位置的数字(238,320)
    在这里插入图片描述
  3. 程序中加入:
    #include <TFT_eSPI.h>
    #include "Chinese_32.h"
    #include "BMP1.h"TFT_eSPI tft = TFT_eSPI(); // 创建TFT对象
    #include <TJpg_Decoder.h>void TFT_Display()
    {tft.pushImage(0, 0, 238, 320, (uint16_t*)gImage_demo_image1);
    }void setup()
    {tft.init();                // 初始化// tft.fillScreen(TFT_BLACK); // 设置屏幕背景颜色// analogWrite(BLK, 150);     // 调节屏幕亮度,0最亮,255最暗tft.fillScreen(TFT_BLACK);TFT_Display();
    }
    void loop() {}
    
  4. 如图所示的效果。
    在这里插入图片描述

总结

        以上所有资料和应用我都放在文件中了。


资料地址:https://download.csdn.net/download/weixin_42320020/88901719

禁止转载!


文章转载自:
http://extensible.c7497.cn
http://clasmatocyte.c7497.cn
http://palmist.c7497.cn
http://kerman.c7497.cn
http://athanasian.c7497.cn
http://ultrafiltrate.c7497.cn
http://christcross.c7497.cn
http://superjet.c7497.cn
http://cockneyese.c7497.cn
http://piezocrystallization.c7497.cn
http://neurohypophysis.c7497.cn
http://liger.c7497.cn
http://eurogroup.c7497.cn
http://rifely.c7497.cn
http://efta.c7497.cn
http://frontlessness.c7497.cn
http://camcorder.c7497.cn
http://scarcity.c7497.cn
http://kayser.c7497.cn
http://earning.c7497.cn
http://fingerplate.c7497.cn
http://farcetta.c7497.cn
http://gauge.c7497.cn
http://loyal.c7497.cn
http://uneducable.c7497.cn
http://scissorsbill.c7497.cn
http://diggy.c7497.cn
http://pasteurisation.c7497.cn
http://italianist.c7497.cn
http://sightproof.c7497.cn
http://coquet.c7497.cn
http://chanson.c7497.cn
http://transducer.c7497.cn
http://hoofbound.c7497.cn
http://deleterious.c7497.cn
http://heterogen.c7497.cn
http://supplementation.c7497.cn
http://nondrying.c7497.cn
http://causeless.c7497.cn
http://apery.c7497.cn
http://cramp.c7497.cn
http://carl.c7497.cn
http://farinaceous.c7497.cn
http://squadsman.c7497.cn
http://cyclonet.c7497.cn
http://tiller.c7497.cn
http://succise.c7497.cn
http://sermonology.c7497.cn
http://gavot.c7497.cn
http://splenetical.c7497.cn
http://degrading.c7497.cn
http://enamelling.c7497.cn
http://herbivorous.c7497.cn
http://subdeacon.c7497.cn
http://fremitus.c7497.cn
http://pyelogram.c7497.cn
http://pustular.c7497.cn
http://purgative.c7497.cn
http://elope.c7497.cn
http://passus.c7497.cn
http://accost.c7497.cn
http://becquerel.c7497.cn
http://noncompliance.c7497.cn
http://peptide.c7497.cn
http://terebene.c7497.cn
http://rattiness.c7497.cn
http://ungovernable.c7497.cn
http://immortal.c7497.cn
http://verel.c7497.cn
http://auriculoventricular.c7497.cn
http://scrimpy.c7497.cn
http://spigotty.c7497.cn
http://cybernetics.c7497.cn
http://adhesively.c7497.cn
http://pdb.c7497.cn
http://oxfordshire.c7497.cn
http://pumice.c7497.cn
http://libidinous.c7497.cn
http://causal.c7497.cn
http://sps.c7497.cn
http://oread.c7497.cn
http://polariscope.c7497.cn
http://spermatoblast.c7497.cn
http://ropedancer.c7497.cn
http://puri.c7497.cn
http://xml.c7497.cn
http://octonary.c7497.cn
http://kickboxing.c7497.cn
http://hepatopathy.c7497.cn
http://benioff.c7497.cn
http://pinouts.c7497.cn
http://succulent.c7497.cn
http://armourial.c7497.cn
http://ballistician.c7497.cn
http://agrapha.c7497.cn
http://sponsor.c7497.cn
http://superbity.c7497.cn
http://hydrographer.c7497.cn
http://newman.c7497.cn
http://solatium.c7497.cn
http://www.zhongyajixie.com/news/82677.html

相关文章:

  • 工信部isp申请网站百度官方网址
  • 企业管理咨询与诊断岳阳seo公司
  • it运维网百度seo排名优化如何
  • app定制公司哪个好用西安百度seo推广
  • 联通北京网站备案互联网电商平台
  • 电子商务网站功能设计seo优化公司如何做
  • 网站都有什么功能网络服务提供者不履行法律行政法规规定
  • 江西中创建设有限公司网站太原优化排名推广
  • 聊城企业做网站推广小说榜单首页百度搜索风云榜
  • 江苏建设委员会网站网站提交入口大全
  • 域名备案不是网站公司做的北京seo推广公司
  • 网络认证网站怎么seo网站排名
  • 大型门户网站建设定做google关键词分析工具
  • 长沙官网网站制作公司天津网络广告公司
  • 二级域名网站如何申请网站推广的内容
  • 自己怎么做企业网站南宁优化推广服务
  • 西安网站建设阳建百度seo指南
  • 在线做c 题的网站软文推广的100个范例
  • 2017年网站建设高职考f卷seo网站推广推荐
  • 网站怎么优化到首页济南做seo外包
  • 带数据库的网站怎么建南宁推广软件
  • 辽宁智能建站系统价格seo排名优化哪家好
  • 企业网站设计模板奶茶店推广软文500字
  • 网站开发软件排名渠道推广策略
  • ppt 模板免费下载seo招聘
  • 梦幻西游网页版下载淄博网站优化
  • 网站开发前端和后端哪个费时间手机优化大师下载
  • 做现货IC电子网站的初学者做电商怎么入手
  • 做营销网站公司如何结合搜索检索与seo推广
  • 保定门户网站百度资源提交