Skip to content

Commit b5311f2

Browse files
committed
Added compile test for Inkplate5V2 (and two test examples).
1 parent 9fba273 commit b5311f2

File tree

6 files changed

+238
-0
lines changed

6 files changed

+238
-0
lines changed

.github/workflows/compile.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ jobs:
77
strategy:
88
matrix:
99
include:
10+
- board:
11+
fqbn: Inkplate_Boards:esp32:Inkplate5
12+
additional-sketch-paths: |
13+
- examples/Inkplate5
14+
- board:
15+
fqbn: Inkplate_Boards:esp32:Inkplate5V2
16+
additional-sketch-paths: |
17+
- examples/Inkplate5V2
1018
- board:
1119
fqbn: Inkplate_Boards:esp32:Inkplate6
1220
additional-sketch-paths: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
Inkplate5V2_Show_Pictures_From_Web example for Soldered Inkplate 5
3+
For this example you will need a USB C cable, Inkplate 5, and an available WiFi connection.
4+
Select "Soldered Inkplate5V2" from Tools -> Board menu.
5+
Don't have "Soldered Inkplate5V3" option? Follow our tutorial and add it:
6+
https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/
7+
8+
You can open .bmp files that have a color depth of 1 bit (BW bitmap), 4 bit, 8 bit and
9+
24 bit AND have resoluton smaller than 960x540 or otherwise it won't fit on screen.
10+
11+
.jpg files encoded with Baseline DCT, Huffman coding are supported.
12+
.png files are generally well supported.
13+
14+
If you are experiencing issues, usually opening the image in an image editor and
15+
exporting it in a different format resolves the issue.
16+
17+
This example will show you how you can download a .bmp and .jpg file from the web and
18+
display that image on Inkplate 5's e-Paper display.
19+
20+
Want to learn more about Inkplate? Visit www.inkplate.io
21+
Looking to get support? Write on our forums: https://forum.soldered.com/
22+
15 March 2024 by Soldered
23+
*/
24+
25+
// Next 3 lines are a precaution, you can ignore those, and the example would also work without them
26+
#ifndef ARDUINO_INKPLATE5V2
27+
#error "Wrong board selection for this example, please select Soldered Inkplate5V2 in the boards menu."
28+
#endif
29+
30+
// Include needed libraries
31+
#include "HTTPClient.h" //Include library for HTTPClient
32+
#include "Inkplate.h" //Include Inkplate library to the sketch
33+
#include "WiFi.h" //Include library for WiFi
34+
35+
// Enter your WiFi credentials
36+
const char *ssid = "";
37+
const char *pass = "";
38+
39+
Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1 Bit mode (BW)
40+
41+
void setup()
42+
{
43+
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
44+
display.clearDisplay(); // Clear frame buffer of display
45+
display.display(); // Put clear image on display
46+
47+
display.setTextSize(2); // Use larger text for easier readability
48+
display.print("Connecting to WiFi...");
49+
display.partialUpdate();
50+
51+
// Connect to the WiFi network.
52+
WiFi.mode(WIFI_MODE_STA);
53+
WiFi.begin(ssid, pass);
54+
while (WiFi.status() != WL_CONNECTED)
55+
{
56+
delay(500);
57+
display.print(".");
58+
display.partialUpdate();
59+
}
60+
display.println("\nWiFi OK! Downloading...");
61+
display.partialUpdate();
62+
63+
// Draw the first image from web.
64+
// Monochromatic bitmap with 1 bit depth. Images like this load quickest.
65+
// NOTE: Both drawImage methods allow for an optional fifth "invert" parameter. Setting this parameter to true
66+
// will flip all colors on the image, making black white and white black. This may be necessary when exporting
67+
// bitmaps from certain softwares. Fourth parameter will dither the image. Photo taken by: Roberto Fernandez
68+
if (!display.drawImage("https://varipass.org/neowise_mono.bmp", 0, 0, false, true))
69+
{
70+
// If is something failed (wrong filename or wrong bitmap format), write error message on the screen.
71+
// REMEMBER! You can only use Windows Bitmap file with color depth of 1, 4, 8 or 24 bits with no compression!
72+
display.println("Image open error");
73+
display.display();
74+
}
75+
display.display();
76+
77+
// Draw the second image from web, this time using a HTTPClient to fetch the response manually.
78+
// Full color 24 bit images are large and take a long time to load, will take around 20 secs.
79+
HTTPClient http;
80+
// Set parameters to speed up the download process.
81+
http.getStream().setNoDelay(true);
82+
http.getStream().setTimeout(1);
83+
84+
// Photo taken by: Roberto Fernandez
85+
http.begin("https://varipass.org/neowise.bmp");
86+
87+
// Check response code.
88+
int httpCode = http.GET();
89+
if (httpCode == 200)
90+
{
91+
// Get the response length and make sure it is not 0.
92+
int32_t len = http.getSize();
93+
if (len > 0)
94+
{
95+
if (!display.drawBitmapFromWeb(http.getStreamPtr(), 0, 0, len))
96+
{
97+
// If is something failed (wrong filename or wrong bitmap format), write error message on the screen.
98+
// REMEMBER! You can only use Windows Bitmap file with color depth of 1, 4, 8 or 24 bits with no
99+
// compression!
100+
display.println("Image open error");
101+
display.display();
102+
}
103+
display.display();
104+
}
105+
else
106+
{
107+
display.println("Invalid response length");
108+
display.display();
109+
}
110+
}
111+
else
112+
{
113+
display.println("HTTP error");
114+
display.display();
115+
}
116+
117+
display.clearDisplay();
118+
delay(3000);
119+
120+
// Try to load image and display it on e-paper at position X=80, Y=70 (centered)
121+
// NOTE: Both drawJpegFromWeb methods allow for an optional fifth "invert" parameter. Setting this parameter to
122+
// true will flip all colors on the image, making black white and white black. Fourth parameter will dither the
123+
// image.
124+
if (!display.drawImage("https://varipass.org/destination.jpg", 80, 70, true, false))
125+
{
126+
// If is something failed (wrong filename or format), write error message on the screen.
127+
display.println("Image open error");
128+
display.display();
129+
}
130+
display.display();
131+
132+
http.end();
133+
134+
WiFi.mode(WIFI_OFF);
135+
}
136+
137+
void loop()
138+
{
139+
// Nothing...
140+
}
174 KB
Loading
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
Inkplate5V2_Partial_Update example for Soldered Inkplate 5
3+
For this example you will need only a USB-C cable and Inkplate 5
4+
Select "Soldered Inkplate5V2" from Tools -> Board menu.
5+
Don't have "Soldered Inkplate5V2" option? Follow our tutorial and add it:
6+
https://soldered.com/learn/add-inkplate-6-board-definition-to-arduino-ide/
7+
8+
In this example we will show how to use partial update functionality of Inkplate 5 e-paper display.
9+
It will scroll text that is saved in char array.
10+
NOTE: Partial update is only available on 1 Bit mode (BW).
11+
It is recommended to do a full refresh every 5-10 partial refresh to maintain good picture quality.
12+
13+
Want to learn more about Inkplate? Visit www.inkplate.io
14+
Looking to get support? Write on our forums: https://forum.soldered.com/
15+
20 March 2023 by Soldered
16+
*/
17+
18+
// Next 3 lines are a precaution, you can ignore those, and the example would also work without them
19+
#ifndef ARDUINO_INKPLATE5V2
20+
#error "Wrong board selection for this example, please select Soldered Inkplate5V2 in the boards menu."
21+
#endif
22+
23+
#include "Inkplate.h" // Include Inkplate library to the sketch
24+
Inkplate display(INKPLATE_1BIT); // Create an object on Inkplate library and also set library into 1-bit mode (BW)
25+
26+
// Char array where you can store your text that will be scrolled.
27+
const char text[] = "This is partial update on Inkplate 5 e-paper display! :)";
28+
29+
// This variable is used for moving the text (scrolling)
30+
int offset = E_INK_WIDTH;
31+
32+
// Variable that keeps count on how much screen has been partially updated
33+
int n = 0;
34+
35+
void setup()
36+
{
37+
display.begin(); // Init Inkplate library (you should call this function ONLY ONCE)
38+
display.clearDisplay(); // Clear frame buffer of display
39+
display.display(); // Put clear image on display
40+
display.setTextColor(BLACK, WHITE); // Set text color to be black and background color to be white
41+
display.setTextSize(4); // Set text to be 4 times bigger than classic 5x7 px text
42+
display.setTextWrap(false); // Disable text wraping
43+
}
44+
45+
void loop()
46+
{
47+
// BASIC USAGE
48+
49+
display.clearDisplay(); // Clear content in frame buffer
50+
display.setCursor(offset, 260); // Set new position for text
51+
display.print(text); // Write text at new position
52+
if (n > 9)
53+
{
54+
// Check if you need to do full refresh or you can do partial update
55+
display.display(); // Do a full refresh
56+
n = 0;
57+
}
58+
else
59+
{
60+
display.partialUpdate(); // Do partial update
61+
n++; // Keep track on how many times screen has been partially updated
62+
}
63+
offset -= 20; // Move text into new position
64+
if (offset < 0)
65+
offset = E_INK_WIDTH; // Text is scrolled till the end of the screen? Get it back on the start!
66+
delay(500); // Delay between refreshes.
67+
68+
// ADVANCED USAGE
69+
70+
display.clearDisplay(); // Clear content in frame buffer
71+
display.setCursor(offset, 260); // Set new position for text
72+
display.print(text); // Write text at new position
73+
74+
display.einkOn(); // Turn on e-ink display
75+
if (n > 9) // Check if you need to do full refresh or you can do partial update
76+
{
77+
display.einkOff(); // Turn off e-ink display after partial updates
78+
display.display(); // Do a full refresh
79+
n = 0;
80+
}
81+
else
82+
{
83+
display.partialUpdate(false, true); // Do partial update
84+
n++; // Keep track on how many times screen has been partially updated
85+
}
86+
offset -= 20; // Move text into new position
87+
if (offset < 0)
88+
offset = E_INK_WIDTH; // Text is scrolled till the end of the screen? Get it back on the start!
89+
delay(500); // Delay between refreshes.
90+
}

0 commit comments

Comments
 (0)