This guide was first published on Jul 29, 2012. It was last
updated on Jul 29, 2012.
This page (Wiring 128x32 SPI OLED display) was last updated on Apr 17, 2019.
128x32 SPI OLEDThe 128x32 SPI OLED is very easy to get up and running because it has built in level shifting. First up, take a piece of 0.1" header 8 pins long.
Plug the header long end down into a breadboard and place the OLED on top. Solder the short pins into the OLED PCB.
Finally, connect the pins to your Arduino - GND goes to ground, Vin goes to 5V, DATA to digital 9, CLK to digital 10, D/C to digital 11, RST to digital 13 and finally CS to digital 12.
(Note: If using the display with other SPI devices, D/C, CLK and DAT may be shared, but CS must be unique for each device.)
This matches the example code we have written. Once you get this working, you can try another set of pins.
Finally you can run the File→Sketchbook→Libraries→Adafruit_SSD1306→SSD1306_128x32_SPI example
If you're using the 128x32 OLED, be sure to uncomment the "#define SSD1306_128_32" in the top of Adafruit_SSD1306.h to change the buffer size