ESP32学习,驱动LED点阵屏,多种方式显示单色图标和彩色位图
上篇是GIF动图显示,这篇显示bmp位图。



亮度调的低,太亮时间长了近距离眼睛不舒服,凑活着看吧。
`
前言
`图标或者位图显示还是比较简单的,主要是位图的生成需要操作一下。
一、制作BMP图片,生成16进制C代码?
我用的显示屏是128*64的,图片宽度128,高度可以随意,图片上下运动可以全部显示。(当然宽度也可以)
打开:lcd-image-converter.exe ,打开准备好的图片,根据上图,preview 生成代码,复制到程序即可。
二、程序
1.主程序
main.cpp(示例):
#include <Arduino.h>
//#include <Adafruit_GFX.h>
#include <ESP32-HUB75-MatrixPanel-I2S-DMA.h>
#include "Object.h"
#include "assets.h" //图形库
#include "bitmapIcon.h" //图形库
MatrixPanel_I2S_DMA *dma_display = nullptr;
Clockface *clockface;
#define String my_TZ="wang";
#define R1_PIN 25
#define G1_PIN 26
#define B1_PIN 27
#define R2_PIN 14
#define G2_PIN 12
#define B2_PIN 13
#define A_PIN 23
#define B_PIN 19 // Changed from library default
#define C_PIN 5
#define D_PIN 17
#define E_PIN 32 //-1 //32
#define LAT_PIN 4
#define OE_PIN 15
#define CLK_PIN 16
/*--------------------- MATRIX PANEL CONFIG -------------------------*/
#define PANEL_RES_X 64//64 // Number of pixels wide of each INDIVIDUAL panel module.
// 库文件需要同步修改 #define MATRIX_WIDTH 128 // Single panel of 64 pixel width
#define PANEL_RES_Y 64//32 // Number of pixels tall of each INDIVIDUAL panel module.
#define PANEL_CHAIN 2//1 // Total number of panels chained one to another
//Another way of creating config structure
//Custom pin mapping for all pins
HUB75_I2S_CFG::i2s_pins _pins={
R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN};
HUB75_I2S_CFG mxconfig(
PANEL_RES_X, // width
PANEL_RES_Y, // height
PANEL_CHAIN, // chain length
_pins, // pin mapping
HUB75_I2S_CFG::FM6126A // driver chip
);
/*
*/
//MatrixPanel_I2S_DMA *dma_display = nullptr;
uint16_t myBLACK = dma_display->color565(0, 0, 0);
uint16_t myWHITE = dma_display->color565(255, 255, 255);
uint16_t myBLUE = dma_display->color565(0, 0, 255);
int resetPin=0;
byte displayBright