Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Hello World example #15

Merged
merged 4 commits into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions examples/Hello_World/Hello_World.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* The MIT License (MIT)
* Copyright (c) 2022 Paperd.Ink
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

#define PAPERDINK_DEVICE Paperdink_Classic // or Paperdink_Merlot
#include <Paperdink.h>

PAPERDINK_DEVICE Paperdink;

void setup()
{
/* Initialize device */
Paperdink.begin();
/* Enable power to display */
Paperdink.enable_display();

cimm marked this conversation as resolved.
Show resolved Hide resolved
/* Print text to display */
GxEPD2_GFX& display = Paperdink.epd;
display.setTextColor(GxEPD_WHITE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating a new display. Would you mind keeping it as Paperdink.epd.setTextColor(GxEPD_BLACK) for all the other display operations too.

Copy link
Contributor Author

@cimm cimm Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I understand this, but I changed what I think you explained. By setting Paperdink.epd.setTextColor(GxEPD_BLACK) I set the text color for all screens to black, not only for the display instance, correct?

display.setCursor(50, display.height()/2);
display.print("Hello World");

/* Send data to display for the update */
Paperdink.epd.display();
}

void loop() {}
6 changes: 6 additions & 0 deletions examples/Hello_World/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Hello World
This example displays "Hello World" in the middle of the screen and is intended as a super simple, minimal example to show how to display text on the screen.

## Usage

Install the Paperd.ink library as explained in the [documentation](https://docs.paperd.ink). Change the `PAPERDINK_DEVICE` on the first line in the example if you have a Merlot Paperd.ink, leave it as is when you have a Classic one. Compile and upload this example to the Paperd.ink device. If everything is successful, the text "Hello World" is displayed in white on a black background.