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.
| Constant | Color |
|---|---|
INKPLATE_BLACK | Black |
INKPLATE_WHITE | White |
INKPLATE_YELLOW | Yellow |
INKPLATE_RED | Red |
INKPLATE_BLUE | Blue |
INKPLATE_GREEN | Green |
Example code
#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 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. 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.fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)returns voidDraws a filled rectangle into the frame buffer. From the Adafruit GFX class the library builds on.
ReturnsNothing.
Parameters
| Type | Name | Description |
|---|---|---|
int16_t | x | Left edge in pixels. |
int16_t | y | Top edge in pixels. |
int16_t | w | Width in pixels. |
int16_t | h | Height in pixels. |
uint16_t | color | One of the six color constants. |
display.display(bool _leaveOn = 0)returns voidSends the whole frame buffer to the panel and refreshes it (a full update).
ReturnsNothing.
Parameters
| Type | Name | Description |
|---|---|---|
bool | _leaveOn | If 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