-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
540 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* 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. | ||
*/ | ||
|
||
/* config.h should be before Paperdink.h */ | ||
#include "config.h" | ||
#include <Paperdink.h> | ||
|
||
/* Create paperdink object */ | ||
PAPERDINK_DEVICE Paperdink; | ||
|
||
void setup() | ||
{ | ||
/* Comment this line to disable Serial debug output */ | ||
DEBUG.begin(115200); | ||
|
||
/* Initialize device */ | ||
Paperdink.begin(); | ||
/* Enable power to display */ | ||
Paperdink.enable_display(); | ||
/* Clear the background */ | ||
Paperdink.epd.fillScreen(GxEPD_WHITE); | ||
/* Connect to Wifi */ | ||
if (Paperdink.connect_wifi(WIFI_NAME, PASSWORD) < 0) { | ||
DEBUG.println("Unable to connect to WiFi"); | ||
Paperdink.epd.drawBitmap(370, 4, wifi_off_sml, wifi_off_sml_width, wifi_off_sml_height, GxEPD_BLACK); | ||
} else { | ||
Paperdink_UI.display_bitmap_https(Paperdink.epd, HOST, PORT, PATH, IMG_FILE, 0, 0, false); | ||
|
||
/* Send data to display for the update */ | ||
Paperdink.epd.display(); | ||
} | ||
|
||
DEBUG.println("Turning off everything"); | ||
|
||
/* Sleep till update time. | ||
* Align updates to 12am so that date change aligns | ||
* with actual day change. | ||
*/ | ||
uint64_t sleep_time = (86400 / (UPDATES_PER_DAY)) - (((Paperdink_Date.mil_hour * 3600) + (Paperdink_Date.min * 60) + (Paperdink_Date.sec)) % (86400 / UPDATES_PER_DAY)); | ||
|
||
/* Update after sleep_time microsecond or when button 1 is pressed. */ | ||
// Paperdink.deep_sleep_timer_wakeup(sleep_time*S_TO_uS_FACTOR); // Consumes lower current | ||
Paperdink.deep_sleep_timer_button_wakeup(sleep_time * S_TO_uS_FACTOR, BUTTON_1_PIN); // Consumes higher current | ||
} | ||
|
||
void loop() | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* 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. | ||
*/ | ||
|
||
/* config.h should be before Paperdink.h */ | ||
#include "config.h" | ||
#include <Paperdink.h> | ||
|
||
/* Create paperdink object */ | ||
PAPERDINK_DEVICE Paperdink; | ||
|
||
void setup() | ||
{ | ||
/* Comment this line to disable Serial debug output */ | ||
DEBUG.begin(115200); | ||
|
||
/* Initialize device */ | ||
Paperdink.begin(); | ||
/* Enable power to display */ | ||
Paperdink.enable_display(); | ||
/* Clear the background */ | ||
Paperdink.epd.fillScreen(GxEPD_WHITE); | ||
/* Connect to Wifi */ | ||
if (Paperdink.connect_wifi(WIFI_NAME, PASSWORD) < 0) { | ||
DEBUG.println("Unable to connect to WiFi"); | ||
Paperdink.epd.drawBitmap(370, 4, wifi_off_sml, wifi_off_sml_width, wifi_off_sml_height, GxEPD_BLACK); | ||
} else { | ||
Paperdink_UI.display_bitmap_https(Paperdink.epd, HOST, PATH, IMG_FILE, 0, 0, false); | ||
|
||
/* Send data to display for the update */ | ||
Paperdink.epd.display(); | ||
} | ||
|
||
DEBUG.println("Turning off everything"); | ||
|
||
/* Sleep till update time. | ||
* Align updates to 12am so that date change aligns | ||
* with actual day change. | ||
*/ | ||
uint64_t sleep_time = (86400 / (UPDATES_PER_DAY)) - (((Paperdink_Date.mil_hour * 3600) + (Paperdink_Date.min * 60) + (Paperdink_Date.sec)) % (86400 / UPDATES_PER_DAY)); | ||
|
||
/* Update after sleep_time microsecond or when button 1 is pressed. */ | ||
// Paperdink.deep_sleep_timer_wakeup(sleep_time*S_TO_uS_FACTOR); // Consumes lower current | ||
Paperdink.deep_sleep_timer_button_wakeup(sleep_time * S_TO_uS_FACTOR, BUTTON_1_PIN); // Consumes higher current | ||
} | ||
|
||
void loop() | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
/* CONFIGURATION | ||
* Uncomment only one of the below #define statements | ||
* based on the paperd.ink device you have | ||
*/ | ||
#define PAPERDINK_DEVICE Paperdink_Classic | ||
//#define PAPERDINK_DEVICE Paperdink_Merlot | ||
|
||
#define WIFI_NAME "HalfBloodKumar" // Wifi Network SSID (name of wifi network) | ||
#define PASSWORD "Summer@2022" // Wifi Network password | ||
|
||
/* Time zone from list https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv */ | ||
#define TIME_ZONE "PST8PDT,M3.2.0,M11.1.0" | ||
|
||
/* Number of times to update starting 12am | ||
* 1 = Updates every 24 hours | ||
* 2 = Updates every 12 hours | ||
* 3 = Updates every 8 hours. Not a good idea since it won't align with day changes. | ||
* 4 = Updates every 6 hours | ||
* ... and so on | ||
* Higher number means lower battery life | ||
*/ | ||
#define UPDATES_PER_DAY 4 | ||
|
||
/* Image URL configuration */ | ||
#define HOST "192.168.1.144" | ||
#define PORT 8010 | ||
#define PATH "/" | ||
#define IMG_FILE "image.bmp" | ||
#endif /* CONFIG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.