Skip to main content

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.

Select Board
Inkplate7SPECTRA_Hello_World.ino
#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 None

Creates 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 void

Initializes 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 void

Fills 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 void

Sets where the next printed text starts, in pixels from the top-left corner. From the Adafruit GFX class the library builds on.

ReturnsNothing.

Parameters

TypeNameDescription
int16_txX coordinate, 0 to 799.
int16_tyY coordinate, 0 to 479.
display.setTextSize(uint8_t s)returns void

Sets the text magnification. Size 1 is the base 5×7 pixel font; 3 makes it three times bigger.

ReturnsNothing.

Parameters

TypeNameDescription
uint8_tsText size multiplier.
display.setTextColor(uint16_t c)returns void

Sets the text color. Use one of the six color constants: INKPLATE_BLACK, INKPLATE_WHITE, INKPLATE_YELLOW, INKPLATE_RED, INKPLATE_BLUE, INKPLATE_GREEN.

ReturnsNothing.

Parameters

TypeNameDescription
uint16_tcColor index, 0 to 5.
display.print(value)returns size_t

Prints 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

TypeNameDescription
text, char or numbervalueWhat to print.
display.display(bool _leaveOn = 0)returns void

Sends the whole frame buffer to the panel and refreshes it (a full update, the only kind this panel takes).

ReturnsNothing.

Parameters

TypeNameDescription
bool_leaveOnIf 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

→