IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 嵌入式 -> 7针oled显示中文及图片arduino。ug8lib -> 正文阅读

[嵌入式]7针oled显示中文及图片arduino。ug8lib

文章目录

前言:

7针oled(spi协议)的引脚说明:

关于中文的显示

关于图片显示:

取模软件


前言:

关于回家没带esp8266usb数据线,所以使用arduino和7针oled连接的小白。网上大多数的都是4针oled关于esp8266的显示教程,本人只有7针oled的。所以查了很多的资料,走了很多的弯路。

7针oled(spi协议)的引脚说明:

GND电源地GND
VCC电源正VCC
D0时钟管脚10
D1数据管脚9
RES复位管脚RES
DC数据和命令控制管脚11
CS片选管脚12

关于中文的显示


#include "U8glib.h"


U8GLIB_SSD1306_128X64 u8g(10, 9, 12, 11);  // SW SPI Com: SCL = 10, SDA = 9, CS = 12, DC = 11,RES=RESET

首先调用U8glib库程序,同时定义数据串口。

void loop(void) {

  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );

}

对主函数进行定义:分别调用显示开始和显示结束的函数u8g.firstPage(),u8g.nextPage(),这之间调用自己定义的draw()。

??

从取模软件进行获取字符串

void draw(void) {

 u8g.drawXBMP( 0, 0,16, 16, str[0]);
 u8g.drawXBMP( 16, 0,16, 16, str[1]);
 u8g.drawXBMP( 32, 0,16, 16, str[2]);
 u8g.drawXBMP( 48, 0,16, 16, str[3]);
}

u8g.drawXBMP

关于更多的u8glib库应用的链接:https://blog.csdn.net/sdlgq/article/details/88659636?ops_request_misc=&request_id=&biz_id=102&utm_term=arduino%20oled%20spi%20%20%E7%94%BB%E5%9B%BE&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~sobaiduweb~default-3-88659636.nonecase&spm=1018.2226.3001.4450?

完整的代码


#include "U8glib.h"


U8GLIB_SSD1306_128X64 u8g(10, 9, 12, 11);  // SW SPI Com: SCL = 10, SDA = 9, CS = 12, DC = 11,RES=RESET

static const unsigned char str[4][32] PROGMEM={

{0x10,0x01,0x10,0x01,0x10,0x01,0x88,0x7F,0x88,0x40,0x4C,0x20,0x2C,0x04,0x0A,0x04,
0x89,0x14,0x88,0x24,0x48,0x24,0x48,0x44,0x28,0x44,0x08,0x04,0x08,0x05,0x08,0x02},/*"你",0*/

{0x08,0x00,0x08,0x3F,0x08,0x20,0x08,0x10,0x3F,0x08,0x24,0x04,0x24,0x04,0xA4,0x7F,
0x24,0x04,0x12,0x04,0x14,0x04,0x08,0x04,0x14,0x04,0x22,0x04,0x21,0x05,0x00,0x02},/*"好",1*/

{0x00,0x00,0xC0,0x3F,0x1E,0x08,0x92,0x08,0x92,0x08,0x92,0x08,0x52,0x08,0xD2,0x7F,
0x12,0x0C,0x12,0x0A,0x1E,0x09,0x92,0x08,0x40,0x08,0x20,0x08,0x00,0x0A,0x00,0x04},/*"呀",2*/

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00},/*":",3*/

/* (16 X 16 , 宋体 )*/
};
void draw(void) {

 u8g.drawXBMP( 0, 0,16, 16, str[0]);
 u8g.drawXBMP( 16, 0,16, 16, str[1]);
 u8g.drawXBMP( 32, 0,16, 16, str[2]);
 u8g.drawXBMP( 48, 0,16, 16, str[3]);
}

void setup(void) {

}

void loop(void) {

  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );

}

成品:

关于图片显示:

代码基本不变:


#include "U8glib.h"

//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE);        // I2C / TWI 
U8GLIB_SSD1306_128X64 u8g(10, 9, 12, 11);  // SW SPI Com: SCL = 10, SDA = 9, CS = 12, DC = 11,RES=RESET

static const unsigned char str1[] PROGMEM={

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0xE0,0xFF,0xFF,0x7F,0xFC,0x03,0xF8,0x07,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0x03,0xF8,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0xFF,0xFF,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0xFF,0xFF,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0xFF,0xFF,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0xFF,0xFF,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0xFF,0xFF,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0xF0,0x1F,0x00,0xFC,0xFF,0xFF,0x07,0x80,0xFF,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/* (16 X 16 , 宋体 )*/
};
void draw(void) {

 u8g.drawXBMP( 0, 0,128, 64, str1);
 
}

void setup(void) {

}

void loop(void) {

  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );

}

成品

取模软件

我用的是??pctolcd2002 完美版

这个软件画图的时候,每画一格就闪一下,非常的刺激眼睛。希望有大佬安利一下好用的取模软件

关于取模软件的设置

处女作就到此了,(狗头。jpg)


  嵌入式 最新文章
基于高精度单片机开发红外测温仪方案
89C51单片机与DAC0832
基于51单片机宠物自动投料喂食器控制系统仿
《痞子衡嵌入式半月刊》 第 68 期
多思计组实验实验七 简单模型机实验
CSC7720
启明智显分享| ESP32学习笔记参考--PWM(脉冲
STM32初探
STM32 总结
【STM32】CubeMX例程四---定时器中断(附工
上一篇文章      下一篇文章      查看所有文章
加:2022-02-14 21:20:17  更:2022-02-14 21:22:37 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/26 9:33:43-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码