OLED Display
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 OLED Display to output information to the user of our application. Using the Tinkerforge Device Manager, 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 Tinkerforge Device Manager, 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");
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);
Last updated
Was this helpful?