This library allows to display text on an OLED display controlled by the SSD1306. It is possible to use both sizes (128x64 and 128x32).
In contrast to other display drivers, this driver does not hold a buffer for execution of paint operations in memory, so the very limited SRAM on Arduino boards stays available for other needs.
Therefore enhanced paint operations (circles, flood fill, lines etc.) are not possible directly. The library is designed for displaying text.
Three fonts are available:
The library uses the Arduino wire library.
The OLED SSD1306 must be connected via I2C (aka TwoWire, TWI or simply Wire).
An instance of the class "SimpleOLED" is needed. As first argument, the constructor expects the I2C address of the display (usually 0x3C), followed by the width (128) and the height (32 or 64) in pixels.
#define DISPLAY_I2C_ADDR 0x3C
#define DISPLAY_WIDTH 128
#define DISPLAY_HEIGHT 32
SimpleOLED Display(DISPLAY_I2C_ADDR, DISPLAY_WIDTH, DISPLAY_HEIGHT);
This function must be called to initialise the display and switch it on.
This function switches off the display.
This function clears the whole content of the display and sets the cursor to the top left corner.
This function changes the font for the following operations. Possible fonts are "default", "Topaz" and "C64". The font height can be set with the parameter "DoubleHeight" - false means 8 pixels, true means 16 pixels.
After changing the font, the cursor position must be set again (see setCursor).
This function sets the cursor position for the following print operations. The values are in characters, not in pixels.
This function writes a string to the display. The only special character is "\n", which performs a carriage return and a line feed.
This function works exactly like the print function, but it adds a carriage return / line feed at the end of the line.
© 1996-2023 by Stefan Trippler (stef2023@[REM0VE]trippler.de)