搜索
搜索

单色电子纸显示屏

浅谈ESP32蓝牙驱动电子纸显示屏

  • 分类:企业博客
  • 作者:
  • 来源:
  • 发布时间:2024-02-26 17:01
  • 访问量:

【概要描述】

浅谈ESP32蓝牙驱动电子纸显示屏

【概要描述】

  • 分类:企业博客
  • 作者:
  • 来源:
  • 发布时间:2024-02-26 17:01
  • 访问量:
详情

ESP32系列模组以其卓越的性能和丰富的外设而闻名,集成了WiFi、传统蓝牙、低功耗蓝牙,提供了高度集成的物联网解决方案。本文以ESP32传统蓝牙为例,介绍了如何利用蓝牙驱动电子纸的整个过程。

 

 

1. 蓝牙配置

1.1 蓝牙设置

 首先,我们需要引入蓝牙串口的头文件并将其重新命名为SerialBT。

   //BT

#include "BluetoothSerial.h"

 

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)

#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it

#endif

BluetoothSerial SerialBT;

 

接着,在设置中初始化蓝牙串口,命名为“ESP32test”。

void setup() {

   //BT

   SerialBT.begin("ESP32test"); //Bluetooth device name  

}

 

 

1.2 蓝牙数据接收

    在主循环中检测蓝牙是否有数据接收,如果有则通过串口发送出去。

  if (SerialBT.available()) //Bluetooth receiving data

  {

Serial.write(SerialBT.read()); //Sending Bluetooth data through serial port

     }

 

 

2. 蓝牙连接及电子纸显示

2.1蓝牙连接

手机端需安装SPP蓝牙调试助手APP,选择传统蓝牙,找到并连接“ESP32test”设备,确认UUID并进行蓝牙配对。通过APP发送数据,例如“01”表示ESP32蓝牙接收OK。

 

1)蓝牙找到“ESP32test”      2)确认UUID                         

 

 

 3)蓝牙配对                             4)输入要发送的数据“01”  

 

 

5)观察计算机串口调试助手,此时会接收到“01”数据,代表ESP32蓝牙接收OK

 

 

2.2 电子纸显示屏显示

  ESP32蓝牙接收到0x01数据后,开始执行电子纸显示屏刷新显示操作。以下是相应的程序操作:

   

    if (SerialBT.available()) //Listen in Bluetooth data

    {

      if(SerialBT.read()==0x01) //Bluetooth received 0x01

      {

        Serial.println("SerialBT==1"); //Bluetooth serial port data printing

 

        //Data initialization settings

        Paint_NewImage(BlackImage, EPD_WIDTH, EPD_HEIGHT, 180, WHITE); //Setscreen size and display orientation

        Paint_SelectImage(BlackImage);

        //BW Image

        Paint_Clear(WHITE);

         Paint_DrawString_EN(0, 0, "Good Display", &Font8, WHITE, BLACK);  //5*8.

Paint_DrawString_EN(0, 10, "Good Display", &Font12, WHITE, BLACK); //7*12.

Paint_DrawString_EN(0, 25, "Good Display", &Font16, WHITE, BLACK); //11*16.

Paint_DrawString_EN(0, 45, "Good Display", &Font20, WHITE, BLACK); //14*20.

Paint_DrawString_EN(0, 80, "Good Display", &Font24, WHITE, BLACK); / /17*24.  

        PIC_display(BlackImage);//EPD_picture--R

        EPD_sleep();//EPD_sleep,Sleep instruction is necessary, please do not delete!!!

      } 

}

 

通过这样的流程,ESP32可以通过蓝牙接收到的数据来触发电子纸显示屏的显示操作。这种整合为物联网应用提供了一种方便而灵活的解决方案。

 

 

 

扫二维码用手机看

底部logo

发布时间:2020-04-27 00:00:00

底部联系方式

发布时间:2020-04-27 00:00:00

0411-8461 9565  

 

 





 
   
网站建设:中企动力 大连

底部版权信息

发布时间:2020-04-27 00:00:00

 ©2007-2025   大连佳显电子有限公司   版权所有    辽ICP备08000578号-1