Arduino Library & Examples
For all of the different kinds of small OLED monochrome displays, you'll need to install the
Arduino libraries. The code we have is for any kind of Arduino, if you're using a different
microcontroller, the code is pretty simple to adapt, the interface we use is basic bit-twiddling
SPI.
To download the Arduino library, visit the Adafruit SSD1306 library repository on
GitHub (http://adafru.it/aHq) . Click the DOWNLOAD button near the upper left, extract the
archive and then rename the uncompressed folder to Adafruit_SSD1306. Confirm that this
folder contains the files Adafruit_SSD1306.cpp and Adafruit_SSD1306.h and the
examples folder.
Place the Adafruit_SSD1306 folder inside your Arduino /libraries folder. You may need to
create this folder if it does not yet exist. In Windows, this would be (home folder)\My
Documents\Arduino\libraries and for Mac or Linux is (home
folder)/Documents/Arduino/libraries. We also have a tutorial on library
installation (http://adafru.it/aYG).
You will need to do the same for the Adafurit_GFX library available here (http://adafru.it/aJa)
After installing the Adafruit_SSD1306 and Adafruit_GFX library, restart the Arduino IDE. You
should now be able to access the sample code by navigating through menus in this order:
File®® Sketchbook®® Libraries®® Adafruit_SSD1306®® SSD1306...
After you've finished wiring the display as indicated on the following pages, load the example
sketch to demonstrate the capabilities of the library and display.
The OLED SSD1306 driver is based on the Adafruit GFX library which provides all the underlying
graphics functions such as drawing pixels, lines, circles, etc. For more details about what you
can do with the OLED check out the GFX library tutorial (http://adafru.it/aPx)
The library cannot determine the screen size via software.
The library cannot determine the screen size via software.
You have to specify it in
You have to specify it in
the header file.
the header file.
Go into the library folder and open the file Adafruit_SSD1306.h.
Go into the library folder and open the file Adafruit_SSD1306.h.
Toward the top you'll see a section of comments that tell how how to edit the file for
Toward the top you'll see a section of comments that tell how how to edit the file for
different kinds of display.
different kinds of display.