取模软件好多,选择困难症又犯了,为了自救,所以自己做了个
工具地址:
http://tools.clz.me/
源代码:
https://github.com/coloz/image-to-bitmap-array
使用方法:
1.准备一张图片,图片分辨率应小于你的显示设备
2.在网页中上传图片
3.复制生成的代码到你的程序中
适用驱动库:u8glib、u8g2等Arduino图形显示设备驱动库。
适用设备: 几乎所有单色点阵屏
相关问题和建议,可以回帖提出
u8g2测试代码:
- /*
- 使用u8g2显示数据
- 图形显示器:OpenJumper 12864 OLED
- 设备核心:SSD1306
- */
- #include <U8g2lib.h>
- #define rst 2
- U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0 , rst);
- //取模得到的数组
- //width:55,height:64
- const unsigned char col[] U8X8_PROGMEM= {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x03,0x00,0x00,0x00,0x00,0xfc,0xff,0x3f,0x00,0x00,0x00,0x00,0x3f,0x00,0xfc,0x00,0x00,0x00,0xc0,0x03,0x00,0xe0,0x03,0x00,0x00,0xf0,0x00,0x00,0x00,0x0f,0x00,0x00,0x38,0x00,0x00,0x00,0x1c,0x00,0x00,0x0e,0x00,0x00,0x00,0x78,0x00,0x00,0x07,0x00,0x00,0x00,0x60,0x00,0x80,0x03,0x00,0x00,0x00,0xc0,0x00,0xc0,0x01,0x00,0x00,0x00,0x80,0x03,0xe0,0x00,0x00,0x00,0x00,0x00,0x03,0x60,0x00,0x00,0x00,0x00,0x00,0x07,0x70,0x00,0x00,0x00,0x00,0x00,0x06,0x30,0x00,0x00,0x00,0x00,0x00,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0x10,0x00,0x00,0x04,0x00,0x18,0x0c,0x18,0x00,0x00,0x0c,0x00,0x30,0x06,0x18,0x00,0x00,0x0c,0x00,0x30,0x06,0x18,0x00,0x00,0x0c,0x00,0x30,0x06,0x18,0x00,0x00,0x0c,0x00,0x30,0x06,0x00,0x00,0x00,0x00,0x00,0x60,0x02,0x00,0x00,0x00,0x00,0x00,0x60,0x03,0x00,0x00,0x00,0xe4,0x00,0x60,0x83,0x04,0x0c,0x06,0xa4,0x00,0x60,0x83,0x0d,0x8c,0x07,0x8c,0x00,0x60,0x03,0x0d,0xfc,0x01,0x08,0x00,0x30,0x03,0x01,0x70,0x00,0x00,0x00,0x30,0x03,0x00,0x00,0x00,0x00,0x00,0x30,0x03,0x00,0x00,0x00,0x00,0x00,0x30,0x06,0x00,0x00,0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00,0x00,0x00,0x0c,0x0e,0x00,0x00,0x00,0x00,0x00,0x0c,0x0c,0x00,0x00,0x00,0x00,0x00,0x06,0x1c,0x00,0x00,0x00,0x00,0x00,0x03,0x38,0x00,0x00,0x00,0x00,0xc0,0x01,0x70,0x00,0x00,0x00,0x00,0xe0,0x00,0xe0,0x00,0x00,0x00,0x00,0x78,0x00,0xc0,0x07,0x00,0x00,0x00,0x1e,0x00,0x00,0x3f,0x00,0x00,0x80,0x07,0x00,0x00,0x78,0x00,0x00,0xc0,0x03,0x00,0x00,0x60,0x00,0x60,0xc0,0x00,0x00,0x00,0x60,0x02,0x60,0xc0,0x00,0x00,0x00,0x60,0x06,0x60,0xc0,0x00,0x00,0x00,0x60,0x06,0x60,0xc0,0x00,0x00,0x00,0x60,0x06,0x30,0xc0,0x00,0x00,0x00,0x60,0x06,0x30,0xcc,0x00,0x00,0x00,0x60,0x06,0x18,0xcc,0x00,0x00,0x00,0x60,0x06,0x0c,0xcc,0x00,0x00,0x00,0x60,0x06,0x0e,0xc6,0x00,0x00,0x00,0xe0,0x0c,0x06,0x86,0x01,0x00,0x00,0xc0,0x18,0x02,0x83,0x03,0x00,0x00,0xe0,0x19,0xe7,0x01,0x03,0x00,0x00,0xf0,0xdf,0xff,0x00,0x03,0x00,0x00,0x38,0xc4,0x18,0x00,0x02,0x00,0x00,0x18,0x60,0x00,0x00,0x03,0x00,0x00,0x0c,0x60,0x00,0x00,0x03,0x00,0x00,0x0c,0x20,0x00,0xc0,0x01,0x00,0x00,0x18,0x60,0x00,0xe0,0x00,0x00,0x00,0x38,0x70,0x00,0x7c,0x00,0x00,0x00,0xf0,0xff,0xff,0x1f,0x00,0x00,0x00,0xc0,0x8f,0xff,0x03,0x00,0x00};
- void setup(void) {
- u8g2.begin();
- }
- void loop(void) {
- u8g2.clearBuffer(); // 清空显示设备内部缓冲区
- u8g2.drawXBMP( 0 , 0 , 55 , 64 , col ); //50,50为图片尺寸,根据你的图片尺寸修改
- u8g2.sendBuffer(); // 显示缓冲区内容
- delay(1000);
- }
复制代码
|