Getting Started with the WeMos OLED Shield

"Showing up is half the battle", but getting anything to show up should be your first goal when starting to work with the WeMos OLED Shield. There are a few key items you will need to get started creating projects on your new shield. We put this blog together to help get you started.

(shield displayed with example code)

Shopping List

   

Libraries will be key to getting the shield working, you will need two libraries provided by Adafruit and one modified version provided by mcauser.

The first library needed is the Adafruit GFX library which can either be downloaded through the Arduino IDE or found on Github at:

https://github.com/adafruit/Adafruit-GFX-Library

The second library you will need is the modified Adafruit_SSD1306 library that can be found at:

https://github.com/mcauser/Adafruit_SSD1306/tree/esp8266-64x48

You can download and extract the zip files for these libraries and place them in your ~/Documents/Arduino/Libraries/ folder. After restarting the Arduino IDE, you should see the folder name you added to the libraries folder under "Sketch" then "Include Library".

After you have installed both libraries, you will be able to use the functions supplied on the libraries to control the OLED shield. These will help you create, size and locate text on the screen as well as draw lines, squares and circles. 

I have included a sketch below which modifies the Github supplied example to show the text display of the shield.

#include "SPI.h"
#include "Wire.h"
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
 
#define OLED_RESET 0  // GPIO0
Adafruit_SSD1306 display(OLED_RESET);
 
void setup()   {
  Serial.begin(9600);
 
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 
  // init done
 
  display.display();
  delay(2000);
 
  // Clear the buffer.
  display.clearDisplay();
 
  // text display tests
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,10);
  display.println("Hello");
  display.println("World");
  
  display.display();
  delay(10000);
  display.clearDisplay();
}
 
 
void loop() {
 
}

Leave a comment

Please note, comments must be approved before they are published