Skip to main content

Six colors

What this example shows​

Inkplate 7SPECTRA has one display mode: every pixel takes one of six colors. This example fills the screen with six vertical bars, one per color, so you can see the whole palette at once.

ConstantColor
INKPLATE_BLACKBlack
INKPLATE_WHITEWhite
INKPLATE_YELLOWYellow
INKPLATE_REDRed
INKPLATE_BLUEBlue
INKPLATE_GREENGreen

Example code​

Select Board
Inkplate7SPECTRA_Full_Screen_Colors.ino
#include "Inkplate.h"

// Declare Inkplate object
Inkplate display;

void setup()
{
// Initialize Inkplate
display.begin();

display.clearDisplay();
// Draw a full screen of all colors
display.fillRect(0, 0, 800 / 6 + 2, 480, INKPLATE_BLACK);
display.fillRect(1 * 800 / 6, 0, 800 / 6 + 2, 480, INKPLATE_WHITE);
display.fillRect(2 * 800 / 6, 0, 800 / 6 + 2, 480, INKPLATE_YELLOW);
display.fillRect(3 * 800 / 6, 0, 800 / 6 + 2, 480, INKPLATE_RED);
display.fillRect(4 * 800 / 6, 0, 800 / 6 + 2, 480, INKPLATE_BLUE);
display.fillRect(5 * 800 / 6, 0, 800 / 6 + 2, 480, INKPLATE_GREEN);

// Show the Image on the screen
display.display();
}

void loop()
{
// Loop forever
}

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. 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.fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)returns void

Draws a filled rectangle into the frame buffer. From the Adafruit GFX class the library builds on.

ReturnsNothing.

Parameters

TypeNameDescription
int16_txLeft edge in pixels.
int16_tyTop edge in pixels.
int16_twWidth in pixels.
int16_thHeight in pixels.
uint16_tcolorOne of the six color constants.
display.display(bool _leaveOn = 0)returns void

Sends the whole frame buffer to the panel and refreshes it (a full update).

ReturnsNothing.

Parameters

TypeNameDescription
bool_leaveOnIf true, the panel supply stays on after the update. Defaults to 0.

What to expect​

The screen shows six vertical bars of equal width, from left to right: black, white, yellow, red, blue and green. The sketch prints nothing to the Serial Monitor.

🔗Open the complete example

examples/Inkplate7SPECTRA/Basic/Inkplate7SPECTRA_Full_Screen_Colors

→