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.
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.
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.
Let’s get started! Follow the steps below to navigate through GitHub and upload the example code to your display.
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"
Click to open the repository.
Open the demo code folder and find the .ino file inside.
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.
Open the Arduino IDE and paste the copied code into the program.
Open the tools tab to verify that the correct Arduino board and port are selected for uploading.
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.
You communicated with our 04×20 Slim OLED!
Want to learn more? Our extended video tutorial covers everything in this post and shows you how to make custom changes to your code.