EVNDisplay#
This class provides the following features and functionalities for our OLED Display Standard Peripheral (SSD1315/SSD1306 IC):
8 Rows of Text Output, with 16 Characters per Row
Built-in I2C Port Selection and De-selection
This is built upon the u8x8 class from u8g2, a versatile graphics library with many fonts and supported displays. This library is focused on displaying text, so if you’d like to tinker with animations, consider using this library instead! However, keep in mind that writing to displays over I2C can be slow.
Note
This class does I2C port selection automatically, so users do not need to call setPort() using their EVNAlpha objects.
Wiring (I2C)#
Host |
Peripheral |
Description |
|---|---|---|
GND |
GND |
Ground (0V) |
3V3 |
VCC |
3.3V Power |
SCL |
SCL |
I2C Serial Clock |
SDA |
SDA |
I2C Serial Data |
Constructor#
- class EVNDisplay(uint8_t port, bool flip_180deg = false)#
- Parameters
port – I2C port the sensor is connected to (1-16)
flip_180deg – Set to
trueto rotate display by 180deg. Defaults tofalse
Functions#
- bool begin()
Initializes display. Call this function before using the other functions.
- Returns
Boolean indicating whether the display was successfully initialized.
- void splashEVN()
Display EVN logo animation for 2 seconds (branding!). Call
clear()afterwards to erase logo.
- void rotate()
Rotate display by 180 degrees.
Printing Data to a Row#
- void writeLabel(uint8_t row, data)
- void print(uint8_t row, data)
Prints data at the start of given row.
- Parameters
row – Row to print to (0-7)
data – Data to be printed. Accepts any data type
- void writeData(uint8_t row, T data)
Prints data to the given row, after any text printed using
writeLabel()This means that fixed text labels (e.g. “LEFTCOLOUR: “) can be printed once using
writeLabel()invoid setup(), while the constantly changing data (e.g. colour sensor reading) can be printed usingwriteData()invoid loop(). This reduces latency compared to rewriting the entire row.- Parameters
row – Row to print to (0-7)
data – Data to be printed. Accepts any data type
Clearing Rows#
- void clear()
Clears all rows on the display
- void clearLine(uint8_t row)
Clears given row on the display
- Parameters
row – Row to print to (0-7)