inkplate-6-arduino-library/test/jpegs/jpegs.ino

103 lines
2.5 KiB
Arduino
Raw Normal View History

2020-09-10 13:50:09 +02:00
#include "Inkplate.h"
#include "SdFat.h"
Inkplate display(INKPLATE_1BIT);
#define DELAYMS 1000
const char *images[] = {"Lenna.jpg", "Lenna.jpg"};
const char *imageUrls[] = {
2020-09-10 15:22:56 +02:00
"https://raw.githubusercontent.com/nitko12/Inkplate-revision/master/test/jpegs/Lenna.jpg",
"https://raw.githubusercontent.com/nitko12/Inkplate-revision/master/test/jpegs/Lenna.jpg",
2020-09-10 13:50:09 +02:00
};
const bool depth[] = {INKPLATE_1BIT, INKPLATE_3BIT};
void setup()
{
Serial.begin(115200);
display.begin();
2020-09-18 10:34:12 +02:00
display.joinAP("", "");
2020-09-10 13:50:09 +02:00
Serial.println();
delay(500);
}
void loop()
{
display.clearDisplay();
display.display();
if (!display.sdCardInit())
{
display.println("Sd card error!");
delay(1000);
return;
}
for (int i = 0; i < 4; ++i)
{
bool dither = i & 1;
bool invert = i >> 1;
for (int j = 0; j < 2; ++j)
{
display.selectDisplayMode(depth[j]);
display.setTextSize(2);
display.setTextColor(1);
display.setCursor(100, 100);
display.print("Displaying ");
display.print(images[j]);
if (!dither)
display.print(" non");
display.print(" dithered and");
if (!invert)
display.print(" non");
display.print(" inverted.");
display.display();
display.clearDisplay();
delay(5000);
2020-09-10 15:22:56 +02:00
Serial.println(display.drawJpegFromSd(images[j], 0, 0, dither, invert));
2020-09-10 13:50:09 +02:00
display.display();
display.clearDisplay();
delay(5000);
}
}
for (int i = 0; i < 4; ++i)
{
bool dither = i & 1;
bool invert = i >> 1;
for (int j = 0; j < 2; ++j)
{
display.selectDisplayMode(depth[j]);
display.setTextSize(2);
display.setTextColor(1);
display.setCursor(100, 100);
display.print("Displaying ");
display.print(images[j]);
display.print(" from web");
if (!dither)
display.print(" non");
display.print(" dithered and");
if (!invert)
display.print(" non");
display.print(" inverted.");
display.display();
display.clearDisplay();
delay(5000);
2020-09-10 15:22:56 +02:00
display.drawJpegFromWeb(imageUrls[j], 0, 0, dither, invert);
2020-09-10 13:50:09 +02:00
display.display();
display.clearDisplay();
delay(5000);
}
}
delay(5000);
}