Difference between revisions of "SDD1306 OLED Display"

From Land Boards Wiki
Jump to navigation Jump to search
(Created page with "== 128x32 OLED == File:Si5351_003_720px.jpg * [https://www.ebay.com/itm/2pcs-0-91-128x32-IIC-I2C-White-OLED-LCD-Display-DIY-Module-For-Arduino/293688288048?ssPageName=ST...")
 
Line 6: Line 6:
  
 
[[File:OLED128x32.PNG]]
 
[[File:OLED128x32.PNG]]
 +
 +
=== Arduino Library for OLED ===
 +
 +
* [https://github.com/olikraus/u8g2 U8g2: Library for monochrome displays, version 2]
 +
** [https://github.com/olikraus/u8g2/wiki/u8g2reference Reference library]
 +
** Constructor
 +
<pre>
 +
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);  // STM32, Ebay OLED
 +
</pre>
 +
* [https://github.com/olikraus/u8g2/wiki/fntlistall List of Fonts]
 +
<pre>
 +
  u8g2.setFont(u8g2_font_ncenB14_tr);
 +
</pre>
 +
 +
==== Hello World Code ====
 +
 +
<pre>
 +
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);  // STM32, Ebay OLED
 +
 +
void setup(void) {
 +
  u8g2.begin();
 +
}
 +
 +
void loop(void) {
 +
  u8g2.clearBuffer(); // clear the internal memory
 +
  u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
 +
  u8g2.drawStr(0,10,"Hello World!"); // write something to the internal memory
 +
  u8g2.sendBuffer(); // transfer internal memory to the display
 +
  delay(1000); 
 +
}
 +
</pre>

Revision as of 13:19, 30 October 2020

128x32 OLED

Si5351 003 720px.jpg

OLED128x32.PNG

Arduino Library for OLED

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);   // STM32, Ebay OLED
  u8g2.setFont(u8g2_font_ncenB14_tr);

Hello World Code

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);   // STM32, Ebay OLED

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.clearBuffer();			// clear the internal memory
  u8g2.setFont(u8g2_font_ncenB08_tr);	// choose a suitable font
  u8g2.drawStr(0,10,"Hello World!");	// write something to the internal memory
  u8g2.sendBuffer();			// transfer internal memory to the display
  delay(1000);  
}