/**********************************************************
* 文件: fsmc-ili9341.ino by 零知实验室(www.lingzhilab.com)
* -^^- 零知开源,让电子制作变得更简单! -^^-
************************************************************/
#include "fsmc_tft.h"
//图片测试文件
#include "image_board.h"
#include "img1.h"
#include "img2.h"
#include "img3.h"
#include "img4.h"
#include "img5.h"
#include "img6.h"
#include "img7.h"
FSMC_TFT tft;
// 复位或上电后运行一次:
void setup() {
//在这里加入初始化相关代码,只运行一次:
Serial.begin(9600);
Serial.println("init lcd");
tft.begin();
uint16_t lcd_id = tft.get_id();
Serial.print("init done, lcd id:0x");
Serial.println(lcd_id,HEX);
/*********************************************************/
//清屏
tft.clear(WHITE);
//设置背景:WHITE, 绘图颜色:RED
tft.setColor(WHITE, RED);
//显示字符串,x,y坐标,尺寸大小
tft.print(16,10,24, "www.lingzhilab.com");
tft.setColor(WHITE, BLUE);
//显示自定义汉字,为减小代码体积,在tft_font中开启16号/24号字体,再然后这里就可以使用了,要与开启字号对应
tft.printCN(70,40,24,"零知开源");
tft.printCN(2,70,24,"让电子制作变得更简单");
//图片表情
tft.showPicture(0,100,20,120,gImage_1);
tft.showPicture(30,100,50,120,gImage_2);
tft.showPicture(60,100,80,120,gImage_3);
tft.showPicture(90,100,110,120,gImage_4);
tft.showPicture(120,100,140,120,gImage_5);
tft.showPicture(150,100,170,120,gImage_6);
tft.showPicture(180,100,200,120,gImage_7);
//图像尺寸要对应,否则容易图像混乱
tft.showPicture(0,140,237,320,gImage_pics);
//绘制圆,坐标80,80,半径20
//tft.circle(80,80,20);
//直线
//tft.line(80,100,90,200);
//矩形
//tft.rectangle(120,100,140,200);
//填充矩形
//tft.fill(150,100,170,200,RED);
//数字,坐标20,130,打印的数字:1234, 数字位数:4, 尺寸:24
//tft.print(20,130,1234,4,24);
}
//一直循环执行:
void loop() {
// 在这里加入主要程序代码,重复执行:
}
很好的资源,学习啦~~