Skip to content

Instantly share code, notes, and snippets.

@jdan
Created April 16, 2021 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdan/74e82ea0b42d1c25e4abd47b08803658 to your computer and use it in GitHub Desktop.
Save jdan/74e82ea0b42d1c25e4abd47b08803658 to your computer and use it in GitHub Desktop.
Arduino code to display hash.jordanscales.com art on an inkplate.io display
#include "Inkplate.h"
#include <HTTPClient.h>
#include <WiFi.h>
Inkplate display(INKPLATE_1BIT);
// https://github.com/jdan/hashart#a-small-screenshot-service
char *url = "https://FILLMEIN/random/800/600/random.png";
void setup()
{
display.begin();
display.clearDisplay();
display.clean();
display.setCursor(50, 290);
display.setTextSize(3);
display.print(F("Loading art"));
display.display();
WiFi.begin("www.example.com", "wifisucks");
while (WiFi.status() != WL_CONNECTED)
{
delay(100);
display.print(".");
display.partialUpdate();
}
display.print("Connected!");
display.partialUpdate();
}
void loop()
{
if (WiFi.status() != WL_CONNECTED)
{
WiFi.reconnect();
delay(5000);
}
display.clearDisplay();
display.drawImage(url, 0, 0, 0, 0);
display.display();
// Sleep for 60 seconds
esp_sleep_enable_timer_wakeup(1000L * 60000L);
(void)esp_light_sleep_start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment