2018年5月24日星期四

DSD TECH 0.91 0.96 1.3 INCH IIC OLED LCD Screen Support U8glib for Arduino AVR

0.96 inch (128*64)

1.3 inch (128*64)

0.91 inch(128*32)

Features

  • 0.96 INCH OLED Screen: Resolution is 128*64,Very Clear,Black background with blue text display.
  • IIC(I2C) interface: Only 4 PIN( VCC, GND, SCL, SDA), Simpler than SPI interface Screen, you can leave more ports for connecting other sensors.
  • Sample Code and Technical Support: You can drive this display through the u8glib library. DSD TECH also provides complete sample code and instruction manuals. you can drive this OLED screen in half an hour,
  • The main chip is SSD1306; supports DC 3.3V to 5.0V supply. Working Temperature: -30 degrees ~ 70 degrees

Arduino Uno OLED Wiring

The image below shows how to connect the Geekcreit 0.96 inch OLED I2C display to Arduino. Pin connections are as follows for wiring the OLED display to an Arduino Uno.
  • OLED GND – Arduino GND
  • OLED VCC – Arduino 5V
  • OLED SCL – Arduino Uno A5
  • OLED SDA – Arduino Uno A4

Install "u8glib" 

You can install “u8glib” via library management of Arduino IDE.
  or you can download library from :  https://github.com/olikraus/u8glib

Demo Code

#include "U8glib.h"

U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // Just for 0.91”(128*32)
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);// for 0.96” and 1.3”

void draw(void) {
 u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 10); 
  u8g.print("Hello World");
}

void setup(void) {
  // flip screen, if required
  // u8g.setRot180();
  

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
}

void loop(void) {
  // picture loop
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  delay(50);
}


1 条评论:

  1. Does this screen work with arduino nano? Seems it does not.

    回复删除