Matrix.drawBMP()
Matrix. drawBMP(x,y,w,h,data)
描述 用来显示一个BMP图片。
参数
返回值 无 示例 彩色点阵:Sensor-Dot Matrix-Color/zh画图 #include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_COLOR); //TYPE_COLOR or TYPE_S2
//取模软件下载地址:https://wiki.microduino.cn/index.php/File:PCtolCD.zip
//取模方法:逆向(低位在前)、逐行、阴码
static const uint8_t logoA[] PROGMEM = { //低位在前 逐行
0x00, 0x00, 0x14, 0x2A, 0x2A, 0x2A, 0x00, 0x00
};
static const uint8_t loveA[] PROGMEM = { //低位在前 逐行
0x00, 0x36, 0x49, 0x41, 0x22, 0x14, 0x08, 0x00
};
static const uint8_t loveB[] PROGMEM = { //低位在前 逐行
0x00, 0x36, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00
};
static const uint8_t small[] PROGMEM = { //低位在前 逐行
0x00, 0x22, 0x55, 0x00, 0x00, 0x22, 0x1C, 0x00
};
//BMP转hex工具:https://www.microduino.cn/wiki/index.php/File:DataToHex.zip
//教程:https://wiki.microduino.cn/index.php/Microduino%E7%82%B9%E9%98%B5%E6%A8%A1%E5%9D%97%E6%98%BE%E7%A4%BABMP%E5%BD%A9%E5%9B%BE/zh
static const uint8_t logoB[] PROGMEM = { //Windows Bitmap (BMP) file,24bit
0x42, 0x4D, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00,
0x00, 0x00, 0xC2, 0x00, 0x00, 0x00, 0x20, 0x2E, 0x00, 0x00, 0x20, 0x2E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xEE, 0xEE,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E, 0xEE, 0xEE,
0xEE, 0xEE, 0xEE, 0xEE, 0xEE, 0xDD, 0x00, 0x00,
};
void setup() {
Wire.begin();
display.setBrightness(255);
display.clearDisplay();
}
void loop() {
display.clearDisplay();
display.setColor(0, 255, 0);
display.drawBMP(0, 0, 8, 8, logoA); //x,y,w,h,data
delay(2000);
display.clearDisplay();
display.setColor(255, 0, 0);
display.drawBMP(0, 0, 8, 8, loveA); //x,y,w,h,data
delay(2000);
display.clearDisplay();
display.drawBMP(0, 0, 8, 8, loveB); //x,y,w,h,data
delay(2000);
display.clearDisplay();
display.setColor(255, 0, 255);
display.drawBMP(0, 0, 8, 8, small); //x,y,w,h,data
delay(2000);
display.clearDisplay();
//Windows Bitmap (BMP) file,24bit
display.drawBMP(0, 0, logoB); //x,y,data
delay(2000);
}
#include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_S2); //TYPE_COLOR or TYPE_S2
//取模软件下载地址:https://wiki.microduino.cn/index.php/File:PCtolCD.zip
//取模方法:逆向(低位在前)、逐行、阴码
static const uint8_t logoA[] PROGMEM = {
0x00, 0x00, 0x14, 0x2A, 0x2A, 0x2A, 0x00, 0x00
};
static const uint8_t loveA[] PROGMEM = {
0x00, 0x36, 0x49, 0x41, 0x22, 0x14, 0x08, 0x00
};
static const uint8_t loveB[] PROGMEM = {
0x00, 0x36, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00
};
static const uint8_t small[] PROGMEM = {
0x00, 0x22, 0x55, 0x00, 0x00, 0x22, 0x1C, 0x00
};
void setup() {
Wire.begin();
display.setBrightness(255);
}
void loop() {
display.clearDisplay();
display.drawBMP(0, 0, 8, 8, logoA); //x,y,w,h,data
delay(2000);
display.clearDisplay();
display.drawBMP(0, 0, 8, 8, loveA); //x,y,w,h,data
delay(2000);
display.clearDisplay();
display.drawBMP(0, 0, 8, 8, loveB); //x,y,w,h,data
delay(2000);
display.clearDisplay();
display.drawBMP(0, 0, 8, 8, small); //x,y,w,h,data
delay(2000);
}
其他 |