Internet of Things
TinkerforgeCode in ActionAbout Me
  • Course Outline
  • 1 - Getting Started
    • Overview
    • Connect to the LED
    • Getting Started
      • Glitch
      • The Application Template
    • Concepts in Programming
      • What is Programming?
      • Variables
      • Functions and Commands
      • Control Structures
      • Loops
      • Objects and Libraries
    • Programming Simple Web Apps
    • Exercises
      • 1.1 Buttons and Inputs
  • 2 - Internet of Things
    • Overview
    • IoT in our Apps
      • Getting Started
        • Hardware Kit
        • Brick Viewer and Daemon
      • Connect to the Devices
        • The Tinkerforge Device Manager
      • Program the Devices
        • RGB LED
        • RGB LED Button
        • OLED Display
        • Sensors
          • Humidity Sensor
          • Ambient Light Sensor
    • Components and Use Cases
    • Exercises
      • 2.1 Lights and Buttons
      • 2.2 Sensors
      • 2.3 Display
  • 3 - Artificial Intelligence
    • Overview
    • AI in our Apps
      • Google's Teachable Machine
      • Face Recognition
      • Training a Custom Model
    • Rules vs. Learning
    • Learning from Data
    • Use Cases
      • Computer Vision
        • Image Classification
        • Handwriting Recognition
    • Machine Learning Algorithms
      • Artificial Neural Networks
      • Decision Trees
      • Logistic Regression
    • Exercises
      • 3.1 Rules vs. Learning
      • 3.2 Fruits and Vegetables
      • 3.3 Face Recognition
      • 3.4 A Classifier for Iris
  • 4 - Cloud & APIs
    • Overview
    • APIs in our Apps
    • Cloud and APIs
      • Weather API
      • NASA Open APIs
      • EDAMAM Nutrition and Recipes API
    • Push Notifications
    • Exercises
  • 5 - App Project
    • Overview
    • Summer 2021
    • Summer 2022
  • Appendix
    • Other Devices
      • Motorized Linear Poti
      • Sound Pressure Sensor
      • NFC Reader
      • Motion Detector
    • UI Features
      • Realtime Charts
      • Countdown Timer
    • Digital Computers
      • Overview
      • The Binary System
      • Code Systems
      • Logic Gates
      • Binary Addition
      • From Analog to Digital
    • Cheat Sheets
    • Projects
      • IoT @ Pickup-Boxes
Powered by GitBook
On this page
  • Goals
  • Get the display
  • Writing text
  • Clear text

Was this helpful?

  1. 2 - Internet of Things
  2. IoT in our Apps
  3. Program the Devices

OLED Display

PreviousRGB LED ButtonNextSensors

Last updated 4 years ago

Was this helpful?

Goals

  • You know how to get a handle on the OLED Display connected to your computer

  • You can write text and clear the display.

Get the display

We can use the to output information to the user of our application. Using the , we get easy to use functions to perform the most important tasks. In this article, we assume you have successfully initialized the devices with the , and you stored all connected devices on a global variable devices. We also declared a global variable oledDisplay.

Next, we need to know the device identifier of the OLED Display. Depending on the size of the display, the identifier is either 263 (128 x 64) or 264 (64x48). In this example, we have the former:

// Get a reference to the display and store in on the global variable
oledDisplay = devices.getDeviceByIdentifier(263);

Now that we have a reference to the display on the variable oledDisplay, we can use that variable to call the display's functions.

Writing text

Writing text to the display is straightforward. The function write() takes 3 arguments: The first two are the line number and the column number where the text should show up. The last argument is the text itself:

oledDisplay.write(0, 0, "Willkommen");

The OLED 128x64 has a maximum of 8 lines and 26 columns for characters. The counting starts at zero, so you can write in line 1 with write(0, 0, "Hello");

Clear text

You can clear the whole display:

oledDisplay.clearDisplay();

Or you can clear just a single line:

// Clear the first line of the display
oledDisplay.clearLine(0);
OLED Display
Tinkerforge Device Manager
Tinkerforge Device Manager