Initialization
Let's get started by writing our first Inkplate sketch! Before using Inkplate in Arduino code, it must be initialized in the setup() function of your sketch. This page contains details on how to do that.
Initializing Inkplate and Updating the Display
The most basic sketch on Inkplate 4TEMPERA is as follows. It initializes Inkplate in memory and clears the e-paper display:
// Include Inkplate Arduino Library.
#include <Inkplate.h>
Inkplate inkplate(INKPLATE_1BIT); // Create Inkplate object
void setup()
{
// Initialize Inkplate
inkplate.begin();
// Update the display
inkplate.display();
// As the frame buffer is empty upon initialization, this will display a blank screen
}
void loop()
{
// Do nothing here
}
Creates inkplate object from inkplate class.
Returns type: none
Function parameters:
| Type | Name | Description |
|---|---|---|
uint8_t | _mode | The display mode to be initialized. INKPLATE_1BIT is BW, INKPLATE_3BIT is Grayscale. |
inkplate.begin()
In short, this function initializes the Inkplate object. This starts I2C, allocates required memory for the frame buffer, and initializes the on-board peripherals.
Returns type: none
inkplate.display()
This function refreshes the display and draws what's currently in the frame buffer. To update the display, this function must be called. This is a full refresh, completely wiping the e-Paper and then drawing what's in the frame buffer.
Returns type: none
Function parameters:
| Type | Name | Description |
|---|---|---|
uint8_t | _leaveOn | Optional. If set to true, the e-Paper won't get turned off after the refresh - this speeds up consecutive refreshes. It's best to use this with partialUpdate and not with this function. |
Display Rotation
If you want to use Inkplate in portrait mode or any 90-degree rotation, use inkplate.setRotation():
inkplate.setRotation()
Set the cardinal rotation of the display; this adjusts the (0, 0) x-y coordinate origin point automatically as well.
Returns value: none
Function parameters:
| Type | Name | Description |
|---|---|---|
uint8_t | _rotation | Ranges from 0-270. 0 is the default rotation, 1 is rotated by 90, 2 by 180, and 3 by 270 degrees. |