Using the SSD1306 OLED display over I2C.

Components

  • 1x SSD1306 Display

Instructions

Connect the VCC and GND on the display to the 3.3v and GND pins on the Pico. Connect SCL (Serial Clock) to GP05 and SDA (Serial Data) to GP04.

Upload the ssd1306_i2c.cpp file to the Pico and watch the display print text, draw lines and flash on and off.

Info

This display works using Inter-Integrated Circuit (IIC I2C). It uses two data wires: a clock and data. The protocol is command based; every time the Pico needs to tell the display something, it sends it a command with some attached data.

A useful feature of I2C is that it is address-based. This means over a hundred different peripherals can share the same two data wires, as long as they each have a unique address.

I2C does not have as high data rates as SPI.

Exercises

Exercise

Mess around with the main function. See if you can edit the text that gets displayed, or draw some shapes with the DrawLine function.

Exercise

Integrate the display with an input component you have previously used.

  • Print text depending on whether a button is being pressed.
  • Print text showing the voltage measured from the ADC with a potentiometer.