VirtualScreen: An Arduino Library for Auto-Spanning Adafruit GFX Graphics Across Multiple Displays / Screens
Seamlessly Integrate Multiple Displays with Ease: A User-Friendly Approach to Expansive Graphics.

- Install the VirtualDisplay Library with the Arduino IDE Library Manager, it will also install the TFT_eSPI library serving as driver for the displays.
ℹ️ There are many examples and display layout included with the library
File > Examples > VirtualDisplay
#include <virtualScreen.h>
VirtualDisplay *tft;
ScreenBuilder screens;
void setup()
{
Serial.begin(115200);
// Adjust this setup according to your actual screen configuration
screens.addRow({{6, 0}, {7, 0}});
tft = new VirtualDisplay(screens.width(), screens.height(), &screens);
tft->begin();
// Use any Adafruit GFX Graphics functions
tft->setTextColor(TFT_CYAN);
tft->setCursor(0,90);
tft->print("Virtual Display");
tft->output(); // Use this function to output the result on the screens
}ℹ️ You can only use display of the same resolution
Add rows of screens (display) by using the addRow() function.
A screen is definded by {int chip_select_pin, int rotation}
screens.addRow({{6, 0}, {7, 0}}); adds a row of two screens of rotation 0, the first screen has a chip select on pin 6, and the other has the chip select on pin 7.
- You have to setup the driver in the TFT_eSPI library configuration files for your display type, see my tutorial on how to do it.
- Any 16 bit-color display supported by the TFT_eSPI library
- Spanning graphics across multiple displays requires a fair amount of memory, use an ESP32 with PSRAM.
- The ESP32-S3 N16R2 is a good choice.
ℹ️ You can use any graphics functions from the Adafruit GFX library
Here are other graphics functions built in the VirtualScreen Library :
| Graphics functions | Description |
|---|---|
| output() | Output to the screens according to your screen layout |
| highlightArea(int16_t x, int16_t y, int16_t width, int16_t height, float intensity) | Highlight a specified area of the canvas with adjustable intensity |
| highlightArea(int16_t centerX, int16_t centerY, int16_t radius, float intensity) | Highlight a circular area of the canvas with adjustable intensity |
| color565(uint8_t r, uint8_t g, uint8_t b) | Convert RGB Color to a 565 color code |
| readRect(int16_t x, int16_t y, int16_t width, int16_t height, uint16_t *buffer) | Read an image area into buffer (must be allocated before calling the function) |
The library will redraw a display only if its content has changed, so avoid redrawing the entire canvas if you can.
Contributors are welcomed! If you want to submit pull requests, here is how you can do it.
