0.96 OLED(Chinese)

From 52Pi Wiki
Jump to navigation Jump to search

0.91'OLED显示模块使用手册

产品简介

0.96'树莓派OLED显示模块具有128X64的显示分辨率,显示区域为23.7*12.8(mm)具有OLED显示屏独有的显示细腻,清晰,低功耗的特点,可以显示汉字,图形,ASCII,用于各种树莓派制作中

0.96OLED top.jpg

产品参数

项目 参数
产品名称 树莓派:0.96'OLED显示模块
分辨率 128×64
屏幕尺寸 0.96
显示面积 23.7×12.8MM
显示屏尺寸 26.6×19.2×1.3
模块尺寸 36.5(长)x29.7(宽)x11.9(高)MM
像素相邻间距 0.17×0.17
像素尺寸 0.15×0.15
工作电压 3.3V

产品展示

P14.JPGP13.JPGP15.JPG

安装于树莓派端

P5.JPGP4.JPGP2.JPG

夜晚下的表现

P12.JPGP10.JPGP11.JPG

产品尺寸


0.96show2.png

电气连接图


0.96show1.png

如何使用

  • 初次使用请确保树莓派spi端口已经打开,打开spi接口请输入: sudo raspi-config

0.96tech2.png

  • 在设置页面下选择第8项Advanced options ,进入后选择SPI打开SPI接口,稍后等待重启完成


0.96tech4.png

  • 下载0.96'OLED树莓派端驱动ssd1306 driver,下载完成后解压缩复制到树莓派用户目录下


0.96tech1.png

  • 输入指令sudo apt-get install build-essential git-core libi2c-dev i2c-tools lm-sensors安装驱动屏幕所需要的组件


0.96tech6.png

  • 待安装完成后,进入源码目录下输入sudo make编译驱动源码

0.96tech7.png

  • 进去examples目录下输入make,编译示例源码

0.96tech8.png

  • 编译成功后可以发现examples文件夹下已经多出一个可执行文件,输入sudo ./ssd1306_demo执行该文件,可以发现屏幕已经成功点亮了

0.96tech10.png
Test9.JPG

示例代码说明

#include "OLEDType_SSD1306.h"  //包含驱动的头文件
#include "OLED_GFX.h"          
#include "OLED_SSD1306.h"
OLED_SSD1306 display;  
                                                            //实例化一个类OLED_SSD1306对象
const unsigned char rpi_2[128] = { /* 0X00,0X01,0X1A,0X00,0X20,0X00, */           //图片的二进制文件
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X07,0XC1,0XF0,0X00,0X18,0X32,0X06,0X00,
0X10,0X0C,0X02,0X00,0X11,0X0C,0X02,0X00,0X10,0X4C,0X84,0X00,0X08,0X2D,0X04,0X00,
0X0C,0X1E,0X08,0X00,0X06,0X3F,0X10,0X00,0X03,0XE1,0XF0,0X00,0X04,0X40,0X18,0X00,
0X08,0XC0,0X88,0X00,0X09,0XFF,0XE4,0X00,0X0F,0X1C,0X34,0X00,0X1E,0X0C,0X1E,0X00,
0X24,0X0C,0X12,0X00,0X24,0X0C,0X01,0X00,0X24,0X0C,0X11,0X00,0X26,0X1E,0X19,0X00
0X2F,0XE1,0XFB,0X00,0X1B,0XC0,0XE6,0X00,0X10,0XC0,0XC6,0X00,0X10,0XC0,0X84,0X00,
0X08,0X40,0X84,0X00,0X08,0X73,0X0C,0X00,0X06,0X7F,0X98,0X00,0X01,0XC0,0XE0,0X00,
0X00,0XC0,0XC0,0X00,0X00,0X33,0X00,0X00,0X00,0X0C,0X00,0X00,0X00,0X00,0X00,0X00,
};

unsigned char rpi_3[128] = { /* 0X00,0X01,0X1A,0X00,0X20,0X00, */               //图片的二进制文件
0XFF,0XFF,0XFF,0XC0,0XFF,0XFF,0XFF,0XC0,0XF8,0X3E,0X0F,0XC0,0XE7,0XCD,0XF9,0XC0,
0XEF,0XFB,0XFD,0XC0,0XEE,0XF3,0XFD,0XC0,0XEF,0XB3,0X7B,0XC0,0XF7,0XD2,0XFB,0XC0,
0XFF,0XE1,0XFF,0XC0,0XFD,0XC0,0XEF,0XC0,0XFC,0X1E,0X0F,0XC0,0XFB,0XBF,0XE7,0XC0,
0XF7,0X3F,0X77,0XC0,0XF6,0X00,0X1B,0XC0,0XF0,0XE3,0XCB,0XC0,0XE1,0XF3,0XE1,0XC0,
0XDB,0XF7,0XFD,0XC0,0XDB,0XF3,0XFE,0XC0,0XDB,0XF3,0XEE,0XC0,0XD9,0XE1,0XE6,0XC0,
0XD0,0X1E,0X04,0XC0,0XE4,0X3F,0X19,0XC0,0XEF,0X3F,0X39,0XC0,0XFF,0XBF,0X7B,0XC0,
0XF7,0XBF,0X7B,0XC0,0XF7,0X8C,0XF3,0XC0,0XF9,0X80,0X67,0XC0,0XFE,0X3F,0X1F,0XC0,
0XFF,0X3F,0X3F,0XC0,0XFF,0XDC,0XFF,0XC0,0XFF,0XF3,0XFF,0XC0,0XFF,0XFF,0XFF,0XC0,
};

int main(int argc, char **argv)
{
	if ( !display.init(OLED_SPI_DC,OLED_SPI_RESET,OLED_SPI_CS0,OLED_OLED_SPI_128x64) )    //初始化SPI驱动,否则退出
		exit(EXIT_FAILURE);                     
	display.begin();                                                                      //开始显示
	display.clearDisplay();                                                               //清空屏幕
	display.drawBitmap(0,20,rpi_3,32,32,1);                                               //显示图片函数位置为X:0,Y:20,图片为:RPI_3,图片长:32,图片宽:32,显示为黑色字体
	display.drawBitmap(32,20,rpi_2,32,32,1);                                              //显示图片函数位置为X:32,Y:20,图片为:RPI_2,图片长:32,图片宽:32,显示为黑色字体
	display.drawBitmap(64,20,rpi_3,32,32,1);                                              //显示图片函数位置为X:64,Y:20,图片为:RPI_3,图片长:32,图片宽:32,显示为黑色字体
        display.drawBitmap(96,20,rpi_2,32,32,1);                                              //显示图片函数位置为X:96,Y:20,图片为:RPI_2,图片长:32,图片宽:32,显示为黑色字体
        display.setTextSize(1);                                                               //设置字体大小为1号
	display.setTextColor(WHITE);                                                          //设置字体显示颜色为白色
	display.setCursor(29,0);                                                              //设置字体显示位置为X:29,:Y:0
	display.print("Hello World");                                                         //设置显示字体内容为Hello World
	display.setCursor(29,8);                                                             //设置显示字体的位置为X:29,Y:8
	display.print("www.52pi.cn");                                                         //设置显示的字体内容为www.52pi.cn
	display.display();                                                                    //显示内容
        usleep(10000);                                                                        //延时

}

购买链接

附件


1306-0.96-CODE.zip
Media:SSD1306-Revision 1.0.pdf
如对此页的规则或教程有意见者,可到此网页或是在管理员Powup333的讨论页留言。