fbpx
MagicCode Lesson 09: Onboard OLED Screen
MagicCode Lesson 9

Using the onboard OLED Screen

Display text, simple logos and images on the OLED screen

Components Required

Magicbit
Buy

Introduction

Color OLED screen on Magicbit can display text as well as simple logos & images.

Learning Outcomes

From this example, you’ll get an understanding about,
  • Using Adafruit OLED library

Theory

Magicbit has a 0.96” OLED screen which can be communicated with from the I2C protocol. The display has the address, 0x3c.

Methodology

We create the content we need to print onto the screen using “Write [Text] on display” and “Draw [shape] on display” blocks. You can display your content where you want by giving the location with corresponding X and Y coordinates. In this display, the X coordinate is within the range of “0 to 128” and the Y coordinate has the “0 to 64” range. There are some other blocks to clear the display, set the font size, and set the shape size with Magicbit blocks.

Drag and drop the following blocks from the block palate and create the following Script.

Script

Sample script

Explanation 

This program starts by clicking the green flag on the MagicCode interface. The second block clears the display. It means all the pixels are off. After that, the third block of the script sets font size. The next box is responsible for writing the given text on the given location on the screen.

Note: Make a program to display the ADC value of the potentiometer on the OLED display.

Related Posts
Leave a Reply