0.96 OLED

從 YFRobotwiki
在2017年9月2日 (六) 14:01由Allblue對話 | 貢獻所做的修訂版本

跳到: 導覽搜尋
0.96OLED模塊


產品簡介


OLED(Organic Light-Emitting Diode):有機發光二極管又稱為有機電激光顯示,由美籍華裔教授鄧青雲在實驗室中發現,由此展開了對OLED的研究。OLED顯示技術具有自發光的特性,採用非常薄的有機材料塗層和玻璃基板,當有電流通過時,這些有機材料就會發光,而且OLED顯示屏幕可視角度大,並且能夠節省電能。OLED由於同時具備自發光、不需背光源、對比度高、厚度薄、視角廣、反應速度快、可用於撓曲面板、使用溫度範圍廣、結構及製程簡單等優異之特性,被認為下一代平面顯示器新興應用技術。 最先接觸的12864屏都是LCD的,需要背光,功耗較高,而OLED的功耗低,更加適合小系統;由於兩者發光材料的不同,在不同的環境中,OLED的顯示效果更佳。


規格參數


  • 兼容3.3V~5V電壓
  • 三色可選:模塊有兩種單色和黃藍雙色兩種顏色可選,單色為純白色和純藍色,雙色為黃藍雙色
  • 高分辨率:分辨率為128*64
  • 接口模式:4線串行SPI接口模式
  • 字庫:可顯示標準的國標簡體(GB2312)漢字、8*16點ASCII粗體字庫、7*8點ASCII字庫、5*7點ASCII字庫
  • 超小尺寸:顯示尺寸為0.96寸,模塊尺寸為27mm(長)*26mm(寬)*4mm(高)


引腳說明

名稱 說明
GND
VCC 電源(3.3-5V)
CLK 4線ISP接口模式:時鐘線

GT20L16S1Y的時鐘線

DIN 4線ISP接口模式:串行數據線

GT20L16S1Y的串行數據輸入端口

D/C 4線ISP接口模式:命令/數據標誌位
CS1 4線ISP接口模式:OLED片選
SO GT20L16S1Y的串行數據輸出端口
CS2 GT20L16S1Y的片選端口


應用示例

示例代碼

示例一:基本顯示

Face.ino:

/**************************************************
   Face
   ( 8x8 Led Dot Matrix with two 74HC595 on Arduino)

   by YFROBOT
 ***************************************************/

#include "TimerOne.h"
#include "face.h"
// 默认显示
#define ROW_DATA ((row[0]<<7)|(row[1]<<6)|(row[2]<<5)|(row[3]<<4)|(row[4]<<3)|(row[5]<<2)|(row[6]<<1)|(row[7]<<0))
#define COL_DATA ((col[0]<<7)|(col[1]<<6)|(col[2]<<5)|(col[3]<<4)|(col[4]<<3)|(col[5]<<2)|(col[6]<<1)|(col[7]<<0))
// 垂直翻转
//#define ROW_DATA ((row[0]<<0)|(row[1]<<1)|(row[2]<<2)|(row[3]<<3)|(row[4]<<4)|(row[5]<<5)|(row[6]<<6)|(row[7]<<7))
//#define COL_DATA ((col[0]<<0)|(col[1]<<1)|(col[2]<<2)|(col[3]<<3)|(col[4]<<4)|(col[5]<<5)|(col[6]<<6)|(col[7]<<7))

// flip horizontal
#define flip_horizontal 7-screenCol    // 默认显示
//#define flip_horizontal screenCol      // 水平翻转

//Pin connected to DS of 74HC595
int SER = 10;
//Pin connected to ST_CP of 74HC595
int RCK  = 11;
//Pin connected to SH_CP of 74HC595
int SRCK  = 12;
int row[8] = {
  0, 0, 0, 0, 0, 0, 0, 0
};
int col[8] = {
  0, 0, 0, 0, 0, 0, 0, 0
};
byte screen[8] = {
  0, 0, 0, 0, 0, 0, 0, 0
};
volatile byte screenRow = 0;
volatile byte screenCol = 0;

// A counter to know what frame we're showing
int animationIndex = 0;
// 8x8 Point temporary array
byte brightnesses[64];

void setup() {
  //  Timer1.initialize(100);
  pinMode(RCK, OUTPUT);
  pinMode(SRCK, OUTPUT);
  pinMode(SER, OUTPUT);
  //  Timer1.attachInterrupt(doubleBuffer);
  Serial.begin(9600);
}

void doubleBuffer() {
  int k = 8;
  while (k--) {
    row[screenRow] = 0;
    col[screenCol] = 1;

    screenCol++;
    if (screenCol >= 8) {
      screenCol = 0;
      screenRow++;
      if (screenRow >= 8) {
        screenRow = 0;
      }
    }

    if ((screen[screenRow] >> flip_horizontal) & B1 == B1) {
      row[screenRow] = 1;
      col[screenCol] = 0;
      digitalWrite(RCK, LOW);
      shiftOut(SER, SRCK, MSBFIRST, COL_DATA); //先选择列
      shiftOut(SER, SRCK, MSBFIRST, ROW_DATA); //再送行数据
      digitalWrite(RCK, HIGH);
    }
  }
}

void UpdataDate() {
  if (animationIndex < animationFrames) {
    for (int i = 0; i < 64; i++) {
      int Dot = (animation[animationIndex][i / 4] >> (i % 4 * 2));
      brightnesses[i] = (Dot & B1) || (Dot & B10);
      screen[7 - i / 8] |= (brightnesses[i] << (i % 8)) ;
    }
  }
  unsigned long startime = millis();
  while (millis() - startime < animationDelays[animationIndex])
  {
    doubleBuffer();
  }
  animationIndex ++;
  if (animationIndex >= animationFrames) {
    //restart animation index
    animationIndex = 0;
  }
  for (int i = 0; i < 8; i++)
    screen[i] = B0;
}

void loop() {
  UpdataDate();
}


face.h:

int animationFrames = 2;

int animationDelays[] = { 1000, 1000 };

// Animation is designed for 8x8 pixels
uint8_t animation[][16] = {
  { 0x55, 0x55, 0x11, 0x44, 0x5, 0x50, 0x1, 0x40, 0x51, 0x45, 0x11, 0x44, 0x11, 0x44, 0x55, 0x55 },
  { 0x5, 0x50, 0x5, 0x50, 0x0, 0x0, 0x40, 0x1, 0x40, 0x1, 0x0, 0x0, 0x4, 0x10, 0x50, 0x5 }
};


0.96OLED模塊使用資料]

演示視頻



參考資料





返回首頁

更多建議和問題歡迎反饋至 YFRobot論壇

購買方式:YFRobot 電子工作室