Hello world
What this example shows
The smallest useful sketch: start the library, write Hello World! into the frame buffer in black, and refresh the screen once. Everything you draw goes into the frame buffer first, and nothing changes on the panel until you call display().
Example code
Select Soldered Inkplate 7SPECTRA under Tools → Board before you upload.
#include "Inkplate.h" // Include the Inkplate library
Inkplate display; // Create an Inkplate object for Inkplate 7SPECTRA
void setup() {
display.begin(); // Initialize the display hardware
display.clearDisplay(); // Clear the frame buffer (does NOT clear the physical screen)
display.setCursor(10, 10); // Set the text position to (10, 10) pixels
display.setTextSize(3); // Set text size to 3 (default is 1)
display.setTextColor(INKPLATE_BLACK); // Set text color to black
display.print("Hello World!"); // Print "Hello World!" at the set position
display.display(); // Refresh the e-paper display to show changes
}
void loop() {
// No code needed here for this example
}
Functions used
Inkplate()returns NoneCreates the Inkplate object. Inkplate 7SPECTRA has a single six-color mode, so the constructor takes no mode argument.
ReturnsConstructor; no return value.
display.begin()returns voidInitializes the library, the peripherals and the frame buffer, which starts out white. Call it once in setup(); later calls are ignored.
ReturnsNothing.
display.clearDisplay()returns voidFills the frame buffer with white. It does not change the panel; call display() afterwards for that.
ReturnsNothing.
display.setCursor(int16_t x, int16_t y)returns voidSets where the next printed text starts, in pixels from the top-left corner. From the Adafruit GFX class the library builds on.
ReturnsNothing.
Parameters
| Type | Name | Description |
|---|---|---|
int16_t | x | X coordinate, 0 to 799. |
int16_t | y | Y coordinate, 0 to 479. |
display.setTextSize(uint8_t s)returns voidSets the text magnification. Size 1 is the base 5×7 pixel font; 3 makes it three times bigger.
ReturnsNothing.
Parameters
| Type | Name | Description |
|---|---|---|
uint8_t | s | Text size multiplier. |
display.setTextColor(uint16_t c)returns voidSets the text color. Use one of the six color constants: INKPLATE_BLACK, INKPLATE_WHITE, INKPLATE_YELLOW, INKPLATE_RED, INKPLATE_BLUE, INKPLATE_GREEN.
ReturnsNothing.
Parameters
| Type | Name | Description |
|---|---|---|
uint16_t | c | Color index, 0 to 5. |
display.print(value)returns size_tPrints text, a character or a number at the cursor, into the frame buffer. The display object inherits from the Arduino Print class, so it prints like Serial does.
ReturnsNumber of bytes printed.
Parameters
| Type | Name | Description |
|---|---|---|
| text, char or number | value | What to print. |
display.display(bool _leaveOn = 0)returns voidSends the whole frame buffer to the panel and refreshes it (a full update, the only kind this panel takes).
ReturnsNothing.
Parameters
| Type | Name | Description |
|---|---|---|
bool | _leaveOn | If true, the panel supply stays on after the update. Defaults to 0. |
What to expect
Hello World! appears in black near the top-left corner, three times the base text size. The sketch prints nothing to the Serial Monitor.
🔗Open the complete example
examples/Inkplate7SPECTRA/Basic/Inkplate7SPECTRA_Hello_World