Google calendar draft
This commit is contained in:
parent
0c5d9f8cce
commit
37449f27a0
|
@ -97,14 +97,14 @@ void Inkplate::begin(void)
|
||||||
//Draw function, used by Adafruit GFX.
|
//Draw function, used by Adafruit GFX.
|
||||||
void Inkplate::drawPixel(int16_t x0, int16_t y0, uint16_t color)
|
void Inkplate::drawPixel(int16_t x0, int16_t y0, uint16_t color)
|
||||||
{
|
{
|
||||||
if (x0 > 799 || y0 > 599 || x0 < 0 || y0 < 0)
|
if (x0 > _width - 1 || y0 > _height - 1 || x0 < 0 || y0 < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (_rotation)
|
switch (_rotation)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
_swap_int16_t(x0, y0);
|
_swap_int16_t(x0, y0);
|
||||||
x0 = _width - x0 - 1;
|
x0 = _height - x0 - 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
x0 = _width - x0 - 1;
|
x0 = _width - x0 - 1;
|
||||||
|
@ -273,7 +273,7 @@ void Inkplate::drawBitmap3Bit(int16_t _x, int16_t _y, const unsigned char *_p, i
|
||||||
void Inkplate::setRotation(uint8_t r)
|
void Inkplate::setRotation(uint8_t r)
|
||||||
{
|
{
|
||||||
_rotation = r % 4;
|
_rotation = r % 4;
|
||||||
switch (rotation)
|
switch (_rotation)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
_width = E_INK_WIDTH;
|
_width = E_INK_WIDTH;
|
||||||
|
|
|
@ -122,19 +122,23 @@ const uint8_t logo[] = {
|
||||||
0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||||
};
|
|
||||||
|
|
||||||
void setup() {
|
void setup()
|
||||||
|
{
|
||||||
display.begin(); //Init library (you should call this function ONLY ONCE)
|
display.begin(); //Init library (you should call this function ONLY ONCE)
|
||||||
display.clearDisplay(); //Clear any data that may have been in (software) frame buffer.
|
display.clearDisplay(); //Clear any data that may have been in (software) frame buffer.
|
||||||
//(NOTE! This does not clean image on screen, it only clears it in the frame buffer inside ESP32).
|
//(NOTE! This does not clean image on screen, it only clears it in the frame buffer inside ESP32).
|
||||||
display.clean(); //Clear everything that has previously been on a screen
|
display.clean(); //Clear everything that has previously been on a screen
|
||||||
display.setCursor(150, 320); display.setTextSize(4); display.print("Welcome to Inkplate 6!"); display.display(); //Write hello message
|
display.setCursor(150, 320);
|
||||||
|
display.setTextSize(4);
|
||||||
|
display.print("Welcome to Inkplate 6!");
|
||||||
|
display.display(); //Write hello message
|
||||||
delay(5000); //Wait a little bit
|
delay(5000); //Wait a little bit
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop()
|
||||||
|
{
|
||||||
//Example will demostrate funcionality one by one. You always first set everything in the frame buffer and afterwards you show
|
//Example will demostrate funcionality one by one. You always first set everything in the frame buffer and afterwards you show
|
||||||
//it on the screen using display.display().
|
//it on the screen using display.display().
|
||||||
|
|
||||||
|
@ -148,7 +152,8 @@ void loop() {
|
||||||
|
|
||||||
//Now, let's draw some random pixels!
|
//Now, let's draw some random pixels!
|
||||||
display.clearDisplay(); //Clear everything that is inside frame buffer in ESP32
|
display.clearDisplay(); //Clear everything that is inside frame buffer in ESP32
|
||||||
for (int i = 0; i < 600; i++) { //Write 600 black pixels at random locations
|
for (int i = 0; i < 600; i++)
|
||||||
|
{ //Write 600 black pixels at random locations
|
||||||
display.drawPixel(random(0, 799), random(0, 599), BLACK);
|
display.drawPixel(random(0, 799), random(0, 599), BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing 600 random pixels");
|
displayCurrentAction("Drawing 600 random pixels");
|
||||||
|
@ -165,13 +170,24 @@ void loop() {
|
||||||
|
|
||||||
//And again, let's draw some random lines on screen!
|
//And again, let's draw some random lines on screen!
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.drawLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), BLACK);
|
display.drawLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing 50 random lines");
|
displayCurrentAction("Drawing 50 random lines");
|
||||||
display.display();
|
display.display();
|
||||||
delay(DELAY_MS);
|
delay(DELAY_MS);
|
||||||
|
|
||||||
|
//Let's draw some random thick lines on screen!
|
||||||
|
display.clearDisplay();
|
||||||
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
|
display.drawThickLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), BLACK, (float)random(1, 20));
|
||||||
|
}
|
||||||
|
displayCurrentAction("Drawing 50 random lines");
|
||||||
|
display.display();
|
||||||
|
delay(DELAY_MS);
|
||||||
|
|
||||||
//Now draw one horizontal...
|
//Now draw one horizontal...
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.drawFastHLine(100, 100, 600, BLACK); //Arguments are: starting X, starting Y, length, color
|
display.drawFastHLine(100, 100, 600, BLACK); //Arguments are: starting X, starting Y, length, color
|
||||||
|
@ -188,10 +204,12 @@ void loop() {
|
||||||
|
|
||||||
//Now, let' make a grid using only horizontal and vertical lines
|
//Now, let' make a grid using only horizontal and vertical lines
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 800; i += 8) {
|
for (int i = 0; i < 800; i += 8)
|
||||||
|
{
|
||||||
display.drawFastVLine(i, 0, 600, BLACK);
|
display.drawFastVLine(i, 0, 600, BLACK);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 600; i += 4) {
|
for (int i = 0; i < 600; i += 4)
|
||||||
|
{
|
||||||
display.drawFastHLine(0, i, 800, BLACK);
|
display.drawFastHLine(0, i, 800, BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing a grid using horizontal and vertical lines");
|
displayCurrentAction("Drawing a grid using horizontal and vertical lines");
|
||||||
|
@ -207,7 +225,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw rectangles on random location, size 100x150 pixels
|
//Draw rectangles on random location, size 100x150 pixels
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.drawRect(random(0, 799), random(0, 599), 100, 150, BLACK);
|
display.drawRect(random(0, 799), random(0, 599), 100, 150, BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many rectangles");
|
displayCurrentAction("Drawing many rectangles");
|
||||||
|
@ -223,7 +242,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw filled black rectangles on random location, size of 30x30 pixels
|
//Draw filled black rectangles on random location, size of 30x30 pixels
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.fillRect(random(0, 799), random(0, 599), 30, 30, BLACK);
|
display.fillRect(random(0, 799), random(0, 599), 30, 30, BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many filled rectangles randomly");
|
displayCurrentAction("Drawing many filled rectangles randomly");
|
||||||
|
@ -239,7 +259,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw some circles at random location with radius of 25 pixels
|
//Draw some circles at random location with radius of 25 pixels
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 40; i++) {
|
for (int i = 0; i < 40; i++)
|
||||||
|
{
|
||||||
display.drawCircle(random(0, 799), random(0, 599), 25, BLACK);
|
display.drawCircle(random(0, 799), random(0, 599), 25, BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many circles randomly");
|
displayCurrentAction("Drawing many circles randomly");
|
||||||
|
@ -255,7 +276,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw some black filled circles at random location with radius of 15 pixels
|
//Draw some black filled circles at random location with radius of 15 pixels
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 40; i++) {
|
for (int i = 0; i < 40; i++)
|
||||||
|
{
|
||||||
display.fillCircle(random(0, 799), random(0, 599), 15, BLACK);
|
display.fillCircle(random(0, 799), random(0, 599), 15, BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many filled circles randomly");
|
displayCurrentAction("Drawing many filled circles randomly");
|
||||||
|
@ -271,7 +293,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw rounded rectangles on random location, size 100x150 pixels, radius of 5 pixels
|
//Draw rounded rectangles on random location, size 100x150 pixels, radius of 5 pixels
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.drawRoundRect(random(0, 799), random(0, 599), 100, 150, 5, BLACK);
|
display.drawRoundRect(random(0, 799), random(0, 599), 100, 150, 5, BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many rounded edges rectangles");
|
displayCurrentAction("Drawing many rounded edges rectangles");
|
||||||
|
@ -287,7 +310,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw filled black rects on random location, size of 30x30 pixels, radius of 3 pixels
|
//Draw filled black rects on random location, size of 30x30 pixels, radius of 3 pixels
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.fillRoundRect(random(0, 799), random(0, 599), 30, 30, 3, BLACK);
|
display.fillRoundRect(random(0, 799), random(0, 599), 30, 30, 3, BLACK);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Random rounded edge filled rectangles");
|
displayCurrentAction("Random rounded edge filled rectangles");
|
||||||
|
@ -316,7 +340,8 @@ void loop() {
|
||||||
|
|
||||||
//Write some text on screen with different sizes
|
//Write some text on screen with different sizes
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
display.setTextSize(i + 1); //textSize parameter starts at 0 and goes up to 10 (larger won't fit Inkplate 6 screen)
|
display.setTextSize(i + 1); //textSize parameter starts at 0 and goes up to 10 (larger won't fit Inkplate 6 screen)
|
||||||
display.setCursor(200, (i * i * 8)); //setCursor works as same as on LCD displays - sets "the cursor" at the place you want to write someting next
|
display.setCursor(200, (i * i * 8)); //setCursor works as same as on LCD displays - sets "the cursor" at the place you want to write someting next
|
||||||
display.print("INKPLATE 6!"); //The actual text you want to show on e-paper as String
|
display.print("INKPLATE 6!"); //The actual text you want to show on e-paper as String
|
||||||
|
@ -327,7 +352,8 @@ void loop() {
|
||||||
|
|
||||||
//Write same text on different location, but now invert colors (text is white, text background is black), without cleaning the previous text
|
//Write same text on different location, but now invert colors (text is white, text background is black), without cleaning the previous text
|
||||||
display.setTextColor(WHITE, BLACK); //First argument is text color, while second argument is background color. In monochrome, there are
|
display.setTextColor(WHITE, BLACK); //First argument is text color, while second argument is background color. In monochrome, there are
|
||||||
for (int i = 0; i < 6; i++) { //only two options: BLACK & WHITE
|
for (int i = 0; i < 6; i++)
|
||||||
|
{ //only two options: BLACK & WHITE
|
||||||
display.setTextSize(i + 1);
|
display.setTextSize(i + 1);
|
||||||
display.setCursor(200, 300 + (i * i * 8));
|
display.setCursor(200, 300 + (i * i * 8));
|
||||||
display.print("INKPLATE 6!");
|
display.print("INKPLATE 6!");
|
||||||
|
@ -339,7 +365,8 @@ void loop() {
|
||||||
int r = 0;
|
int r = 0;
|
||||||
display.setTextSize(8);
|
display.setTextSize(8);
|
||||||
display.setTextColor(WHITE, BLACK);
|
display.setTextColor(WHITE, BLACK);
|
||||||
while (true) {
|
while (true)
|
||||||
|
{
|
||||||
display.setCursor(100, 100);
|
display.setCursor(100, 100);
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setRotation(r); //Set rotation will sent rotation for the entire display, so you can use it sideways or upside-down
|
display.setRotation(r); //Set rotation will sent rotation for the entire display, so you can use it sideways or upside-down
|
||||||
|
@ -351,7 +378,8 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Small function that will write on the screen what function is currently in demonstration.
|
//Small function that will write on the screen what function is currently in demonstration.
|
||||||
void displayCurrentAction(String text) {
|
void displayCurrentAction(String text)
|
||||||
|
{
|
||||||
display.setTextSize(2);
|
display.setTextSize(2);
|
||||||
display.setCursor(2, 580);
|
display.setCursor(2, 580);
|
||||||
display.print(text);
|
display.print(text);
|
||||||
|
|
|
@ -21,19 +21,25 @@
|
||||||
Inkplate display(INKPLATE_3BIT); //Create object on Inkplate library and set library to work in grayscale mode (3-bit)
|
Inkplate display(INKPLATE_3BIT); //Create object on Inkplate library and set library to work in grayscale mode (3-bit)
|
||||||
//Other option is monochrome mode, which is demonstrated in next example "2-Inkplate_basic_monochrome"
|
//Other option is monochrome mode, which is demonstrated in next example "2-Inkplate_basic_monochrome"
|
||||||
|
|
||||||
#define DELAY_MS 5000 //Delay in milliseconds between screen refresh. Refreshing e-paper screens more often than 5s is not recommended
|
#define DELAY_MS 5000 //Delay in milliseconds between screen refresh. Refreshing e-paper screens more often than 5s is not recommended \
|
||||||
//Want to refresh faster? Use partial update! Find example in "3-Inkplate-basic_partial_update"
|
//Want to refresh faster? Use partial update! Find example in "3-Inkplate-basic_partial_update"
|
||||||
|
|
||||||
void setup() {
|
void setup()
|
||||||
|
{
|
||||||
display.begin(); //Init library (you should call this function ONLY ONCE)
|
display.begin(); //Init library (you should call this function ONLY ONCE)
|
||||||
display.clearDisplay(); //Clear any data that may have been in (software) frame buffer.
|
display.clearDisplay(); //Clear any data that may have been in (software) frame buffer.
|
||||||
//(NOTE! This does not clean image on screen, it only clears it in the frame buffer inside ESP32).
|
//(NOTE! This does not clean image on screen, it only clears it in the frame buffer inside ESP32).
|
||||||
display.clean(); //Clear everything that has previously been on a screen
|
display.clean(); //Clear everything that has previously been on a screen
|
||||||
display.setTextColor(0,7); display.setCursor(150, 320); display.setTextSize(4); display.print("Welcome to Inkplate 6!"); display.display(); //Write hello message
|
display.setTextColor(0, 7);
|
||||||
|
display.setCursor(150, 320);
|
||||||
|
display.setTextSize(4);
|
||||||
|
display.print("Welcome to Inkplate 6!");
|
||||||
|
display.display(); //Write hello message
|
||||||
delay(5000); //Wait a little bit
|
delay(5000); //Wait a little bit
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop()
|
||||||
|
{
|
||||||
//Example will demostrate funcionality one by one. You always first set everything in the frame buffer and afterwards you show
|
//Example will demostrate funcionality one by one. You always first set everything in the frame buffer and afterwards you show
|
||||||
//it on the screen using display.display().
|
//it on the screen using display.display().
|
||||||
|
|
||||||
|
@ -47,7 +53,8 @@ void loop() {
|
||||||
|
|
||||||
//Now, let's draw some random pixels!
|
//Now, let's draw some random pixels!
|
||||||
display.clearDisplay(); //Clear everything that is inside frame buffer in ESP32
|
display.clearDisplay(); //Clear everything that is inside frame buffer in ESP32
|
||||||
for (int i = 0; i < 1000; i++) { //Write 1000 random colored pixels at random locations
|
for (int i = 0; i < 1000; i++)
|
||||||
|
{ //Write 1000 random colored pixels at random locations
|
||||||
display.drawPixel(random(0, 799), random(0, 599), random(0, 7)); //We are setting color of the pixels using numbers from 0 to 7,
|
display.drawPixel(random(0, 799), random(0, 599), random(0, 7)); //We are setting color of the pixels using numbers from 0 to 7,
|
||||||
} //where 0 mens black, 7 white and gray is in between
|
} //where 0 mens black, 7 white and gray is in between
|
||||||
displayCurrentAction("Drawing 600 random pixels in random colors");
|
displayCurrentAction("Drawing 600 random pixels in random colors");
|
||||||
|
@ -64,13 +71,36 @@ void loop() {
|
||||||
|
|
||||||
//And again, let's draw some random lines on screen!
|
//And again, let's draw some random lines on screen!
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 100; i++) {
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
display.drawLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), random(0, 7));
|
display.drawLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), random(0, 7));
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing 50 random lines in random colors");
|
displayCurrentAction("Drawing 50 random lines in random colors");
|
||||||
display.display();
|
display.display();
|
||||||
delay(DELAY_MS);
|
delay(DELAY_MS);
|
||||||
|
|
||||||
|
//Let's draw some random thick lines on screen!
|
||||||
|
display.clearDisplay();
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
display.drawThickLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), random(0, 7), (float)random(1, 20));
|
||||||
|
}
|
||||||
|
displayCurrentAction("Drawing 50 random lines in random colors and thickness");
|
||||||
|
display.display();
|
||||||
|
delay(DELAY_MS);
|
||||||
|
|
||||||
|
//Let's draw some random gradient thick lines on screen!
|
||||||
|
display.clearDisplay();
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
int startColor = random(0, 7);
|
||||||
|
int endColor = random(startColor, 7);
|
||||||
|
display.drawGradientLine(random(0, 799), random(0, 599), random(0, 799), random(0, 599), startColor, endColor, (float)random(1, 20));
|
||||||
|
}
|
||||||
|
displayCurrentAction("Drawing 50 random lines in random colors and thickness");
|
||||||
|
display.display();
|
||||||
|
delay(DELAY_MS);
|
||||||
|
|
||||||
//Now draw one horizontal...
|
//Now draw one horizontal...
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.drawFastHLine(100, 100, 600, 0); //Arguments are: starting X, starting Y, length, color
|
display.drawFastHLine(100, 100, 600, 0); //Arguments are: starting X, starting Y, length, color
|
||||||
|
@ -87,10 +117,12 @@ void loop() {
|
||||||
|
|
||||||
//Now, let' make a grid using only horizontal and vertical lines in random colors!
|
//Now, let' make a grid using only horizontal and vertical lines in random colors!
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 800; i += 8) {
|
for (int i = 0; i < 800; i += 8)
|
||||||
|
{
|
||||||
display.drawFastVLine(i, 0, 600, (i / 8) & 0x0F);
|
display.drawFastVLine(i, 0, 600, (i / 8) & 0x0F);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 600; i += 4) {
|
for (int i = 0; i < 600; i += 4)
|
||||||
|
{
|
||||||
display.drawFastHLine(0, i, 800, (i / 8) & 0x0F);
|
display.drawFastHLine(0, i, 800, (i / 8) & 0x0F);
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing a grid using horizontal and vertical lines in different colors");
|
displayCurrentAction("Drawing a grid using horizontal and vertical lines in different colors");
|
||||||
|
@ -106,7 +138,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw rectangles on random location, size 100x150 pixels in random color
|
//Draw rectangles on random location, size 100x150 pixels in random color
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.drawRect(random(0, 799), random(0, 599), 100, 150, random(0, 7));
|
display.drawRect(random(0, 799), random(0, 599), 100, 150, random(0, 7));
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many rectangles in random colors");
|
displayCurrentAction("Drawing many rectangles in random colors");
|
||||||
|
@ -122,7 +155,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw filled random colored rectangles on random location, size of 30x30 pixels in radnom color
|
//Draw filled random colored rectangles on random location, size of 30x30 pixels in radnom color
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.fillRect(random(0, 799), random(0, 599), 30, 30, random(0, 7));
|
display.fillRect(random(0, 799), random(0, 599), 30, 30, random(0, 7));
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many filled rectangles randomly in random colors");
|
displayCurrentAction("Drawing many filled rectangles randomly in random colors");
|
||||||
|
@ -138,7 +172,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw some random colored circles at random location with radius of 25 pixels in random color
|
//Draw some random colored circles at random location with radius of 25 pixels in random color
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 40; i++) {
|
for (int i = 0; i < 40; i++)
|
||||||
|
{
|
||||||
display.drawCircle(random(0, 799), random(0, 599), 25, random(0, 7));
|
display.drawCircle(random(0, 799), random(0, 599), 25, random(0, 7));
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many circles randomly in random colors");
|
displayCurrentAction("Drawing many circles randomly in random colors");
|
||||||
|
@ -154,7 +189,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw some random colored filled circles at random location with radius of 15 pixels
|
//Draw some random colored filled circles at random location with radius of 15 pixels
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 40; i++) {
|
for (int i = 0; i < 40; i++)
|
||||||
|
{
|
||||||
display.fillCircle(random(0, 799), random(0, 599), 15, random(0, 7));
|
display.fillCircle(random(0, 799), random(0, 599), 15, random(0, 7));
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many filled circles randomly in random colors");
|
displayCurrentAction("Drawing many filled circles randomly in random colors");
|
||||||
|
@ -170,7 +206,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw rounded rectangles on random location, size 100x150 pixels, radius of 5 pixels in radnom color
|
//Draw rounded rectangles on random location, size 100x150 pixels, radius of 5 pixels in radnom color
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.drawRoundRect(random(0, 799), random(0, 599), 100, 150, 5, random(0, 7));
|
display.drawRoundRect(random(0, 799), random(0, 599), 100, 150, 5, random(0, 7));
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many rounded edges rectangles");
|
displayCurrentAction("Drawing many rounded edges rectangles");
|
||||||
|
@ -186,7 +223,8 @@ void loop() {
|
||||||
|
|
||||||
//Draw filled random colored rectangle on random location, size of 30x30 pixels, radius of 3 pixels in radnom color
|
//Draw filled random colored rectangle on random location, size of 30x30 pixels, radius of 3 pixels in radnom color
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
display.fillRoundRect(random(0, 799), random(0, 599), 30, 30, 3, random(0, 7));
|
display.fillRoundRect(random(0, 799), random(0, 599), 30, 30, 3, random(0, 7));
|
||||||
}
|
}
|
||||||
displayCurrentAction("Drawing many filled rectangle with rounded edges in random colors");
|
displayCurrentAction("Drawing many filled rectangle with rounded edges in random colors");
|
||||||
|
@ -215,7 +253,8 @@ void loop() {
|
||||||
|
|
||||||
//Write some text on screen with different sizes and color
|
//Write some text on screen with different sizes and color
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
display.setTextColor(i);
|
display.setTextColor(i);
|
||||||
display.setTextSize(i + 1); //textSize parameter starts at 0 and goes up to 10 (larger won't fit Inkplate 6 screen)
|
display.setTextSize(i + 1); //textSize parameter starts at 0 and goes up to 10 (larger won't fit Inkplate 6 screen)
|
||||||
display.setCursor(200, (i * i * 8)); //setCursor works as same as on LCD displays - sets "the cursor" at the place you want to write someting next
|
display.setCursor(200, (i * i * 8)); //setCursor works as same as on LCD displays - sets "the cursor" at the place you want to write someting next
|
||||||
|
@ -227,7 +266,8 @@ void loop() {
|
||||||
|
|
||||||
//Write same text on different location, but now invert colors (text is white, text background is black)
|
//Write same text on different location, but now invert colors (text is white, text background is black)
|
||||||
display.setTextColor(7, 0); //First argument is text color, while second argument is background color. In greyscale,
|
display.setTextColor(7, 0); //First argument is text color, while second argument is background color. In greyscale,
|
||||||
for (int i = 0; i < 6; i++) { //you are able to choose from 8 different colors (0-7)
|
for (int i = 0; i < 6; i++)
|
||||||
|
{ //you are able to choose from 8 different colors (0-7)
|
||||||
display.setTextSize(i + 1);
|
display.setTextSize(i + 1);
|
||||||
display.setCursor(200, 300 + (i * i * 8));
|
display.setCursor(200, 300 + (i * i * 8));
|
||||||
display.print("INKPLATE6!");
|
display.print("INKPLATE6!");
|
||||||
|
@ -239,7 +279,8 @@ void loop() {
|
||||||
int r = 0;
|
int r = 0;
|
||||||
display.setTextSize(8);
|
display.setTextSize(8);
|
||||||
display.setTextColor(7, 0);
|
display.setTextColor(7, 0);
|
||||||
while (true) {
|
while (true)
|
||||||
|
{
|
||||||
display.setCursor(100, 100);
|
display.setCursor(100, 100);
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setRotation(r); //Set rotation will sent rotation for the entire display, so you can use it sideways or upside-down
|
display.setRotation(r); //Set rotation will sent rotation for the entire display, so you can use it sideways or upside-down
|
||||||
|
@ -254,7 +295,8 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Small function that will write on the screen what function is currently in demonstration.
|
//Small function that will write on the screen what function is currently in demonstration.
|
||||||
void displayCurrentAction(String text) {
|
void displayCurrentAction(String text)
|
||||||
|
{
|
||||||
display.setTextSize(2);
|
display.setTextSize(2);
|
||||||
display.setCursor(2, 580);
|
display.setCursor(2, 580);
|
||||||
display.print(text);
|
display.print(text);
|
||||||
|
|
Loading…
Reference in New Issue