0.96寸12864 OLED 显示屏
概述
0.96寸 128*64显示屏OLED模块是一款无需背景光源,自发光式的显示模块。模块采用蓝色背景,显示尺寸控制在0.96英寸,采用OLED专用驱动芯片SSD1306控制。该模块支持通过I2C接口与控制器通信,支持高传输速率,能够实现60Hz的刷新频率。模块采用Gravity I2C通用接口,无需额外杜邦线,即可直插Arduino主控器,从此摆脱繁杂的接线苦恼。另外显示屏采用了铝合金外框封装,在保护屏幕不受损伤的同时,也能防止您在使用过程中,不被屏幕的玻璃边缘划伤。 OLED又称作有机发光二极管,相比传统的LCD,OLED具备更快的响应速度和更轻薄的体积优势,屏幕厚度可以小于1毫米,仅为LCD屏幕的1/3左右。并且功耗更低,抗震性好,可以广泛应用于移动设备的显示应用上。配合一些mini的Arduino主控器,如Uno,Nano等小板,完全可以自己制作一款带显示功能的智能穿戴设备。
资料链接:https://pan.baidu.com/s/1B5fd4_tG7XQJbiCLO3iy8A 提取码:8888
性能描述
工作电压:3.3V~5V
显示颜色:白色
像素个数:128列 × 64行
接口方式:Gravity-I2C
刷屏速率:60帧/秒
亮度:60 (Typ) cd/m2
全屏点亮功耗:约22.75mA
工作温度:-30℃~+70℃
引脚定义
VCC:3V3~5V电源输入
GND:电源地
SCL:I2C时钟线
SDA:I2C数据线
孔距:16mm
*注:该显示模块的接口是Gravity-I2C标准接口,支持3.3V\~5V电源输入。*
安装尺寸
Arduino平台应用
库文件的支持
库文件的安装方式,请参考如何安装库?
例子程序
打开文件->示例->U8glib->U8gLogo,如下图所示:
选择 U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_DEV_0); // I2C / TWI,取消注释,如下图所示:
代码块如下
/*
U8gLogo.pde
Put the U8GLIB logo on the display.
>>> Before compiling: Please remove comment from the constructor of the
>>> connected graphics display (see below).
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
Copyright (c) 2012, olikraus@gmail.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE | U8G_I2C_OPT_DEV_0); // I2C / TWI
//#define MINI_LOGO
void drawColorBox(void)
{
u8g_uint_t w, h;
u8g_uint_t r, g, b;
w = u8g.getWidth() / 32;
h = u8g.getHeight() / 8;
for ( b = 0; b < 4; b++ )
for ( g = 0; g < 8; g++ )
for ( r = 0; r < 8; r++ )
{
u8g.setColorIndex((r << 5) | (g << 2) | b );
u8g.drawBox(g * w + b * w * 8, r * h, w, h);
}
}
void drawLogo(uint8_t d)
{
#ifdef MINI_LOGO
u8g.setFont(u8g_font_gdr17r);
u8g.drawStr(0 + d, 22 + d, "U");
u8g.setFont(u8g_font_gdr20n);
u8g.drawStr90(17 + d, 8 + d, "8");
u8g.setFont(u8g_font_gdr17r);
u8g.drawStr(39 + d, 22 + d, "g");
u8g.drawHLine(2 + d, 25 + d, 34);
u8g.drawVLine(32 + d, 22 + d, 12);
#else
u8g.setFont(u8g_font_gdr25r);
u8g.drawStr(0 + d, 30 + d, "U");
u8g.setFont(u8g_font_gdr30n);
u8g.drawStr90(23 + d, 10 + d, "8");
u8g.setFont(u8g_font_gdr25r);
u8g.drawStr(53 + d, 30 + d, "g");
u8g.drawHLine(2 + d, 35 + d, 47);
u8g.drawVLine(45 + d, 32 + d, 12);
#endif
}
void drawURL(void)
{
#ifndef MINI_LOGO
u8g.setFont(u8g_font_4x6);
if ( u8g.getHeight() < 59 )
{
u8g.drawStr(53, 9, "code.google.com");
u8g.drawStr(77, 18, "/p/u8glib");
}
else
{
u8g.drawStr(1, 54, "code.google.com/p/u8glib");
}
#endif
}
void draw(void) {
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
drawColorBox();
}
u8g.setColorIndex(1);
if ( U8G_MODE_GET_BITS_PER_PIXEL(u8g.getMode()) > 1 ) {
drawLogo(2);
u8g.setColorIndex(2);
drawLogo(1);
u8g.setColorIndex(3);
}
drawLogo(0);
drawURL();
}
void setup(void) {
// flip screen, if required
//u8g.setRot180();
}
void loop(void) {
// picture loop
u8g.firstPage();
do {
draw();
u8g.setColorIndex(1);
} while ( u8g.nextPage() );
// rebuild the picture after some delay
delay(200);
}
Mind+(基于Scratch3.0)图形化编程
1、下载及安装软件。下载地址:https://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装
2、切换到“上传模式”。 详细教程:Mind+基础wiki教程-上传模式编程流程
3、“扩展”中选择“主控板”中的“Arduino Uno”,“显示器”中选择“OLED-2864显示屏”。 详细教程:Mind+基础wiki教程-加载扩展库流程
4、进行编程,程序如下图: 5、菜单“连接设备”,“上传到设备”
指令表
通过设置指令,可以指定OLED显示的行列地址、显示模式等。详细指令及解释参考SSD1306.pdf文件28~48页。
上述指令表中有一个set memory addressing Mode指令如下:(可参考SSD1306.pdf文件P30页)
A[1:0] = 00b, Horizontal Addressing Mode A[1:0] = 01b, Vertical Addressing Mode A[1:0] = 10b, Page Addressing Mode (RESET) A[1:0] = 11b, Invalid
例子程序中没有设置,即默认选择Page Addressing Mode 模式,详细解释可参考SSD1306.pdf文件P25页、P34页。
共分成8页(page0~page7),每页8行(0~7行),总64行;每行128列(seg0~seg127)。
所以,当选择Page Addressing Mode模式,地址选择PAGE2页、seg3列,写入0xff,则屏幕15~23行的seg3列被点亮,如下图:
常见问题
还没有客户对此产品有任何问题,欢迎通过qq或者论坛联系我们!
更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖。
更多