(SKU:DFR0480)FireBeetle Covers-3.5" TFT LCD Display

来自DFRobot Product Wiki
跳转至: 导航搜索
产品名称

Update/modify/delete Forbidden, 禁止更改本图,请更改图片名称,避免覆盖上传

目录

简介


技术规格

  • 工作电压: 3.3V
  • 最大工作电流:150mA
  • 通信接口:SPI
  • 支持micro SD卡
  • 屏幕分辨率: 320*480
  • 响应时间:0.1ms
  • 对比度:500:1
  • 可视角度:70/70°
  • 外形尺寸: 84.5mm x 54.5mm


尺寸图

  • pin脚间距:2.54mm
  • 主板尺寸:84.5mm×54.5mm
  • 板厚:1.6mm
Fig1:FireBeetle Covers-3.5" TFT LCD Display尺寸图

功能示意图

Fig2:FireBeetle Covers-3.5" TFT LCD Display功能示意图

PinOut

Fig3:FireBeetle Covers-3.5" TFT LCD Display PinOut


使用教程

准备

硬件

1 x ESP8266控制板(或者ESP32控制板)

1 x FireBeetle Covers-3.5" TFT LCD Display(v1.0)模块(装入SD卡

软件

Arduino IDE (根据能够使用的Arduino版本来选择,不要盲目追求最新版本), 点击下载Arduino IDE

点击下载DFRobot_ILI9488-master.zip压缩包并解压缩
点击下载DFRobot_Display-master.zip压缩包并解压缩
点击下载SD_SPI-master.zip压缩包并解压缩
将解压缩后的文件加到arduino的库文件夹里

基本图形绘制

硬件连接

连接电源线后,将FireBeetle Covers-3.5" TFT LCD Display(v1.0)模块与esp2866(或esp32)直插即可。

代码样例
选择端口和开发板esp8266(或esp32)后,如图所示打开DFRobot_ILI9488_drawBasicGraphics,将程序下载到开发板上

Fig3:FireBeetle Covers-ePaper Display Module PinOut
#include "DFRobot_ILI9488_SPI.h"

#if((defined __ets__) || (defined ESP_PLATFORM))
uint8_t pin_cs = 0, pin_cd = D4, pin_SD_cs = D3;
#else
uint8_t pin_cs = 2, pin_cd = 4, pin_SD_cs = 3;
#endif

DFRobot_ILI9488_SPI tft(pin_cs, pin_cd);

void setup(void)
{
  delay(500);
  Serial.begin(115200);
  _DEBUG_PRINT("\n  ILI9488 DISPLAY TEST !");
  tft.begin();
  //tft.supportChineseFont();
}

#define drawAxis()        tft.fillScreen(0); \
                          tft.drawVLine(0, -240, 480, DISPLAY_WHITE); \
                          tft.drawHLine(-160, 0, 320, DISPLAY_WHITE)

void loop(void)
{
  tft.fillScreen(DISPLAY_RED); delay(500);

  tft.setOrign(160, 240);
  drawAxis();
  tft.setTextColor(DISPLAY_YELLOW);
  tft.setTextSize(4);
  tft.setCursor(0, 0);
#if((defined __ets__) || (defined ESP_PLATFORM))
  tft.printf("fire\nBeetle oh\tye");
  tft.setCursor(0, 240);
  tft.printf("1 + 1 = %d  ", 2);
#else
  tft.print("fire\nBeetle oh\tye");
  tft.setCursor(0, 240);
  tft.println("1 + 1 = 2");
  tft.println("2 + 2 = 4");
#endif
  delay(500);
  drawAxis();
  //draw round rectangle
  tft.drawRoundRect(20, 20, 80, 80, 20, DISPLAY_ORANGE);
  tft.drawRoundRect(-20, 20, -80, 80, 20, DISPLAY_ORANGE);
  tft.drawRoundRect(-20, -20, -80, -80, 20, DISPLAY_ORANGE);
  tft.drawRoundRect(20, -20, 80, -80, 20, DISPLAY_ORANGE);
  delay(500);
  //fill round rectangle
  tft.fillRoundRect(20, 20, 80, 80, 20, DISPLAY_ORANGE);
  tft.fillRoundRect(-20, 20, -80, 80, 20, DISPLAY_ORANGE);
  tft.fillRoundRect(-20, -20, -80, -80, 20, DISPLAY_ORANGE);
  tft.fillRoundRect(20, -20, 80, -80, 20, DISPLAY_ORANGE);
  delay(500);
  drawAxis();
  //draw lines
  tft.drawLine(-40, -40, 40, 40, DISPLAY_RED);
  tft.drawLine(40, -40, -40, 40, DISPLAY_RED);
  tft.drawLine(-200, -20, 200, -20, DISPLAY_RED);
  tft.drawLine(-200, 20, 200, 20, DISPLAY_RED);
  tft.drawLine(20, -400, 20, 400, DISPLAY_RED);
  tft.drawLine(-20, -400, -20, 400, DISPLAY_RED);
  delay(500);
  drawAxis();
  //draw rectangle
  tft.drawRect(20, 20, 80, 80, DISPLAY_BLUE);
  tft.drawRect(-20, 20, -80, 80, DISPLAY_BLUE);
  tft.drawRect(-20, -20, -80, -80, DISPLAY_BLUE);
  tft.drawRect(20, -20, 80, -80, DISPLAY_BLUE);
  delay(500);
  //fill rectangle
  tft.fillRect(20, 20, 80, 80, DISPLAY_BLUE);
  tft.fillRect(-20, 20, -80, 80, DISPLAY_BLUE);
  tft.fillRect(-20, -20, -80, -80, DISPLAY_BLUE);
  tft.fillRect(20, -20, 80, -80, DISPLAY_BLUE);
  delay(500);
  drawAxis();
  //draw circle
  tft.drawCircle(60, 60, 40, DISPLAY_CYAN);
  tft.drawCircle(-60, 60, 40, DISPLAY_CYAN);
  tft.drawCircle(-60, -60, 40, DISPLAY_CYAN);
  tft.drawCircle(60, -60, 40, DISPLAY_CYAN);
  delay(500);
  //fill circle
  tft.fillCircle(60, 60, 40, DISPLAY_CYAN);
  tft.fillCircle(-60, 60, 40, DISPLAY_CYAN);
  tft.fillCircle(-60, -60, 40, DISPLAY_CYAN);
  tft.fillCircle(60, -60, 40, DISPLAY_CYAN);
  delay(500);
  drawAxis();
  //draw triangle
  tft.drawTriangle(0, -120, -80, 120, 80, 120, DISPLAY_GREEN);
  delay(500);
  //fill triangle
  tft.fillTriangle(0, -120, -80, 120, 80, 120, DISPLAY_GREEN);
  delay(500);
}

程序功能:展示包括画点、画线、画矩形框、填充矩形、画圆、填充圆。

效果展示

Fig3:FireBeetle Covers-3.5" TFT LCD Display 画圆效果展示

部分函数说明

DFRobot_ILI9488_SPI tft(pin_cs, pin_cd);

//创建tft对象,其中pin_cs和pin_cd为显示屏的两个控制引脚

_DEBUG_PRINT("\n  ILI9488 DISPLAY TEST !");

//_DEBUG_PEINR为宏定义,位于DFRobot_Types.h文件中。

fillScreen(int16_t color);

//用颜色填充屏幕

setOrign(int16_t x, int16_t y);

//设置源节点的轴(相对于左上角)

drawAxis();

//建一个坐标原点为(160,240)的坐标系

setTextColor(uint16_t color);

//设置文本颜色

setTextSize(uint8_t size);

//设置文本大小

setCursor(int16_t x, int16_t y);

//设置打印点轴(相对于左上角)

drawRoundRect(int16_t x,int16_t y,int16_t width,int16_t height,int16_t r,uint16_t color);

//画一个圆角矩形,并设置矩形的颜色,(x,y)为矩形的起始点,width为矩形的宽,height为矩形的高,r为矩形圆角的半径

drawWLine(int16_t x0,int16_t y0,int16_t x1,int16_t y1,uint16_t color);

//画一条线,并设置线线的颜色(x0,y0),(x1,y1)为先的始末两点

drawRect(int16_t x,int16_t y,int16_t width,int16_t height,uint16_t color);

//画矩形,并设置矩形四边的颜色,x为起始点的x轴,y为起始点的y轴,width为矩形的宽height为矩形的高

fillRect(int16_t x,int16_t y,int16_t width,int16_t height,uint16_t color);

//画矩形,并用颜色填充矩形

drawCircle(int16_t x,int16_t y,int16_t r,uint16_t color);

//画一个圆,并设置圆的颜色

fillCircle(int16_t x,int16_t y,int16_t r,uint16_t color);

//画一个圆,并用颜色填充圆,x为圆心所在的x轴,y为圆心所在的y轴,r为圆的半径

drawTriangle(int16_t x0,int16_t y0,int16_t x1,int16_t y1,int16_t x2,int16_t y2,uint16_t color);

//画三角形,并设置三角形三边的颜色 (x0,y0),(x1,y1),(x2,y2)分别为三角形三个顶点

fillTriangle(int16_t x0,int16_t y0,int16_t x1,int16_t y1,int16_t x2,int16_t y2,uint16_t color);

//画一个三角形,并用颜色填充三角形

SD卡中图片显示

硬件连接

将具有图片的SD卡插入FireBeetle Covers-ePaper Display Module模块,然后与esp8266(或esp32)直插即可。

代码样例
如图所示,打开DFRobot_ILI9488_drawBitmap,将程序下载到开发板上

Fig3:FireBeetle Covers-ePaper Display Module PinOut
#include "DFRobot_ILI9488_SPI.h"

#if((defined __ets__) || (defined ESP_PLATFORM))
#include "SD_SPI.h"
uint8_t pin_cs = 0, pin_cd = D4, pin_SD_cs = D3;
#else
#include "SD.h"
uint8_t pin_cs = 2, pin_cd = 4, pin_SD_cs = 3;
#endif

DFRobot_ILI9488_SPI tft(pin_cs, pin_cd);

void setup(void)
{
  delay(500);
  Serial.begin(115200);
  tft.begin();
  //tft.supportChineseFont();

  while(!SD.begin(pin_SD_cs)) {
    Serial.print("\n  SD begin faild");
    delay(2000);
  }
  Serial.print("\n  SD begin successful");
}

void loop(void)
{
  tft.fillScreen(DISPLAY_RED);
  delay(500);
  tft.setOrign(0,0);
  tft.fillScreen(0);
  File f = SD.open("Image.bmp", FILE_READ);
  tft.drawBmp(&f,80, 160);
  f.close();
  delay(1000);
}

程序功能:显示SD卡中的图片。

效果展示

Fig3:FireBeetle Covers-3.5" TFT LCD Display SD卡中图片展示
Warning yellow.png

特别注意:要在SD卡中预先存放图片(.bmp格式的图片),你可以多放几组图片显示。

代码中部分函数说明

SD.open("Image.bmp",FILE_READ);

//以只读的方式打开Image.bmp图片

drawBmp(Stream *s, int16_t x, int16_t y);

//显示bmp文件,s为文件描述符,x起始点的x轴,y为起始点的y轴

f.close();

//关闭文件

对SD卡中文件的操作

硬件连接

将SD卡插入FireBeetle Covers-ePaper Display Module模块,然后将其与esp8266(或esp32)直插即可。

代码样例
如图所示,打开DFRobot_SD_demo,然后将程序下载到开发板上,打开串口监视器即可看到效果

Fig3:FireBeetle Covers-ePaper Display Module PinOut
/*
 SD card read/write
 created   Nov 2017
 This example code is in the public domain.
 */

#include <SPI.h>
#include <SD_SPI.h>

#ifdef __AVR__
uint8_t       pin_cs = 3;
#else
uint8_t       pin_cs = D3;
#endif

File myFile;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println();
  Serial.println();
  if (!SD.begin(pin_cs)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  Serial.print("    file name:");
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  SD.remove("test.txt");
  myFile = SD.open("test.txt", FILE_WRITE);

  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing 1, 2, 3.");
    // close the file:
    myFile.close();
    Serial.println("done.");
    if(myFile) {
      Serial.println("file still have value");
    } else {
      Serial.println("file closed");
    }
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
  
  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.print("    file name:");
    Serial.println(myFile.name());
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
  
  myFile = SD.open("Floder/nText.txt");
  if (myFile) {
    Serial.println("Floder/nText.txt:");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening Floder/nText.txt");
  }

  Serial.println("\ncreat direction");
  SD.mkdir("T1");
  SD.rmdir("T1");
  myFile = SD.open("T1");
  if(myFile) {
    Serial.println("del direction faild");
  } else {
    Serial.println("del direction successful");
  }
}

void loop() {
  // nothing happens after setup
}

程序功能
对SD卡中.txt文件的操作,对SD卡中文件的创建和删除。
1.先删除SD卡中原本存在的test.txt文件,然后打开(打开的同时创建)一个test.txt文件,如果成功打开,则串口打印“Writingto test.txt...”,在SD卡中写入“testing 1,2,3.”
  然后关闭文件,并串口打印“done”(若关闭成功则串口打印“file closed”,若失败则打印“file still have value”),若打开失败,则串口打印“error opening test.txt”
2.打开test.txt文件,并显示文件的名字,然后检查test.txt中是否有数据,如果有数据则把数据发送到串口。
3.打开Text.txt文件,然后检查Text.txt中是否有数据,如果有数据则把数据发送到串口。
4.创建一个T1文件,然后删除T1文件。

效果展示

串口显示

代码中部分函数说明

SD.open(char *filepath, uint8_t mode);

//打开文件,filepath为文件路径,mode为打开方式

SD.close();

//关闭SD卡

Serial.write(myFile.read());

//串口打印读取到的文件的一个字节

availale();

//检查文本文件大小

myFile.println("testing 1,2,3.");

//向test.txt中写入内容“testing 1,2,3.”

mkdir("T1");

//创建T1文件

rmdir("T");

//删除T1文件

兼容性测试

MCU 测试通过 测试失败 未测试 特别标注
FireBeetle-Board328P
FireBeetle-ESP32
FireBeetle-ESP8266
Leonardo

常见问题


如果客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。


更多


DFshopping car1.png [Link DFRobot商城购买链接]

个人工具
名字空间

变换
操作
导航
工具箱