Oled Display
Overview
OLED displays provide excellent contrast for small screens. The do not require much power but are a bit more complicated to use than other displays.
Exercise:
Turn off the power to your circuit and connect the OLED as follows.
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
TEACHER CHECK ____
Exercise:
Install the Arduino SSD1306 library. Enter and download the following sample code.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println(“Hello, world!”);
display.display();
}
TEACHER CHECK ____
Exercise:
Modify your code to display your name on the OLED screen in a larger font.
TEACHER CHECK ____
Exercise:
Program your device using the sample code ssd1306_128x64_spi. This will provide an example of what sort of graphics are possible with the OLED screen.