NUCODE 누코드
Published

Add an OLED Screen to Your NU40 DK

Wire a 0.96" SSD1306 OLED to the NU40 DK with 4 jumper wires, scan the I2C bus, and print your first message on screen.

BeginnerProtip16
Add an OLED Screen to Your NU40 DK

Things used in this project

Hardware components

NU40 DK
nRF52840 dev board by Nucode (nucode.store)
×1
0.96" SSD1306 128x64 I2C OLED (4-pin)
×1
Jumper wires (generic)
Jumper wires (generic)
×4
USB Cable, USB Type C Plug
USB Cable, USB Type C Plug
×1

Software apps and online services

Arduino IDE
Arduino IDE
Adafruit SSD1306 + Adafruit GFX libraries

Story

Read more

Code

hello_oled.ino

Arduino
Shows "Hello, NU40 DK!" on the OLED; LED1 lights up if the screen isn't found.
// NU40 DK - Hello OLED
// Shows "Hello, NU40 DK!" on a 0.96" SSD1306 128x64 I2C OLED.
// Wiring: GND-GND, SDA-P0.26, SCL-P0.27, VCC-VMOD (3.3 V)

#include <Adafruit_TinyUSB.h>  // required on this board
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// Last two numbers = I2C speed (400 kHz). Set it here; Wire.setClock() is ignored.
Adafruit_SSD1306 display(128, 64, &Wire, -1, 400000, 400000);

void setup() {
  // Always pass the address 0x3C (use 0x3D if your scan shows that).
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    pinMode(PIN_LED1, OUTPUT);
    digitalWrite(PIN_LED1, HIGH);  // LED1 on = OLED not found
    while (true) delay(100);
  }
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0, 0);
  display.println("Hello,");
  display.println("NU40 DK!");
  display.display();
}

void loop() {}

Credits

NUCODE 누코드
9 projects • 1 follower
Hi, we're Nucode, based in Seoul, South Korea! We'll make starting your hardware project much easier :)

Comments