Before you start wiring, a strip of header must be soldered onto the OLED. It is not possible to "press-fit" the header, it must be attached!
Start by placing an 8-pin piece of header with the long ends down into a breadboard for stability
Place the OLED on top so all the short ends of the header stick thru the header pads
Finish by soldering each of the 8 pins to the 8 pads!
The nice thing about the 128x64 OLEDs is that they can be used with I2C (+ a reset line) or SPI. SPI is generally faster than I2C but uses more pins. It's also easier for some microcontrollers to use SPI. Anyways, you can use either one with this display
To start, you'll need to solder the two jumpers on the back of the OLED. Both must be soldered 'closed' for I2C to work!
Finally, connect the pins to your Arduino
- GND goes to ground
- Vin goes to 5V
- Data to I2C SDA (on the Uno, this is A4 on the Mega it is 20 and on the Leonardo digital 2)
- Clk to I2C SCL (on the Uno, this is A5 on the Mega it is 21 and on the Leonardo digital 3)
- RST to digital 4 (you can change this pin in the code, later)
This matches the example code we have written. Once you get this working, you can try a different Reset pin (you can't change the SDA and SCL pins).
Finally you can run the File→Sketchbook→Libraries→Adafruit_SSD1306→SSD1306_128x64_i2c example
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
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_128x64_spi example