Home Guides Beginner’s Guide to Prototyping Displays

Beginner’s Guide to Prototyping Displays

by Newhaven Staff
Published: Last Updated on 472 views

How to use example code to Test your display

In this guide, you’ll learn how to locate example code, download it from our code library or GitHub, and upload it to your microcontroller for prototyping with your display. This tutorial uses our 04×20 Slim OLED, but you can apply this same process to all of our displays.

Finding Code in Newhaven Display's code library

Remember to check newhavendisplay.com for hundreds of example codes written by our engineers. These resources are designed specifically for our displays and are available for free in our example code library.

  1. Start at newhavendisplay.com
  2. Navigate to Example Code under the Engineering & Quality dropdown
  3. Browse by display type and select the code for your application
  4. Copy the code and paste it into your integrated development environment (IDE)
  5. Edit the code and/or upload it to your microcontroller

Finding Code on GitHub

GitHub is a repository for open-source software where users can find code examples for our displays. You’ll find a wide variety of example codes here available for free. Using these codes will help you see the different features and functions our displays are capable of.

Image of laptop and GitHub logo

Let’s get started! Follow the steps below to navigate through GitHub and upload the example code to your display.

Screenshot of "find a repository" search bar on GitHub

In the “find a repository” search bar, enter the display part number to see available code. You'll see results start to populate as you type. The part number for our 04x20 Slim OLED is "0420cw"

Screenshot of NHD-0420CW-Slim-OLED repository on GitHub

Click to open the repository.

Screenshot of NHD 0420CW DemoCode folder on GitHub

Open the demo code folder and find the .ino file inside.

Screenshot indicating SlimOLED0420CWDemoCode.ino file on GitHub

The full code will expand when you click the .ino file. Now you can copy the code directly from the page and paste it into your
integrated development environment (IDE).
Be sure to copy the entire code from beginning to end.

Uploading Code to Arduino

Screenshot indicating where to paste the copied example code in Arduino IDE

Open the Arduino IDE and paste the copied code into the program.

Screenshot demonstrating how to confirm that the correct Arduino board and port are selected

Open the tools tab to verify that the correct Arduino board and port are selected for uploading.

Screenshot highlighting the button to begin uploading to Arduino

Click the arrow button in the top left corner of the window to begin uploading the program to Arduino.

When the code is finished uploading, you’ll see the result on your display. 

Congratulations 🎉

You communicated with our 04×20 Slim OLED! 

GIF of 04x20 OLED display with scrolling text on screen

Watch: Example Code & GitHub Tutorial

Want to learn more? Our extended video tutorial covers everything in this post and shows you how to make custom changes to your code.

You may also like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.