Easily display labels and values on an OLED screen with custom fonts and formatting.
UltiBlox on GitHub | UltiBlox Home
The DisplayValueOLED library simplifies displaying text and values on OLED screens, making it ideal for embedded projects needing dynamic information display. It provides options for setting fonts, centering text, and adding suffixes (e.g., units) to values.
- Display custom labels and values with optional suffixes.
- Set separate fonts for labels and values.
- Automatically center text on the display.
- Clear lines to update display content without residual artifacts.
The DisplayValueOLED library is compatible with DisplayValueLCD for LCD displays. Both libraries share the same function signatures, allowing you to switch between OLED and LCD displays by simply changing the library declaration in your code.
- Open the Arduino IDE.
- Go to Tools > Manage Libraries.
- Search for UltiBlox-DisplayValueOLED and click Install.
- Access example sketches under File > Examples > UltiBlox-DisplayValueOLED.
-
Clone the Repository:
git clone git@github.com:UltiBlox/DisplayValueOLED.git ~/workspace/DisplayValueOLED cd ~/workspace/DisplayValueOLED
-
Prepare the Environment: Run the
prepare.shscript to set up dependencies:bash prepare.sh
-
Install the Library:
-
Copy Installation:
bash install.sh
-
Symlink Installation (for active development):
bash install-symlink.sh
-
-
Build Examples: Compile example sketches with:
bash build.sh
- U8x8lib: Required for OLED display communication.
- Arduino Core Library
Refer to the HelloWorld.ino file for a complete usage example demonstrating basic display setup and usage.
init()Initializes the OLED display and clears any previous content.
clear()Clears the entire display content.
setLabel(const char* value)Sets and centers a label text at the top of the display.
setValue(int value)Displays the specified integer value on the display, centered and using the value font.
setSuffix(const char* value)Sets a suffix, such as a unit symbol, to be displayed next to the value.
setLabelFont(const uint8_t* font)setValueFont(const uint8_t* font)Sets custom fonts for the label and value. The library includes default fonts, but these can be customized for distinct visual styles.
- HelloWorld.ino: Displays a label and a sensor value, demonstrating basic setup for the display.