|
|
|
/*
|
|
|
|
* Blink
|
|
|
|
* Turns on an LED on for one second,
|
|
|
|
* then off for one second, repeatedly.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <WiFi.h>
|
|
|
|
#include <WiFiMulti.h>
|
|
|
|
|
|
|
|
#include <GxEPD2_BW.h>
|
|
|
|
#include <Fonts/FreeMonoBold9pt7b.h>
|
|
|
|
#include "bitmaps/Bitmaps128x250.h"
|
|
|
|
|
|
|
|
WiFiMulti wifiMulti;
|
|
|
|
GxEPD2_BW<GxEPD2_213_B72, GxEPD2_213_B72::HEIGHT> display(GxEPD2_213_B72(/*CS=TFT_CS*/ SS, /*DC=*/ TFT_DC, /*RST=*/ TFT_RST, /*BUSY=*/ -1)); // GDEH0213B72
|
|
|
|
|
|
|
|
void helloWorld()
|
|
|
|
{
|
|
|
|
const char HelloWorld[] = "Hello World!";
|
|
|
|
//Serial.println("helloWorld");
|
|
|
|
display.setRotation(1);
|
|
|
|
display.setFont(&FreeMonoBold9pt7b);
|
|
|
|
display.setTextColor(GxEPD_BLACK);
|
|
|
|
int16_t tbx, tby; uint16_t tbw, tbh;
|
|
|
|
display.getTextBounds(HelloWorld, 0, 0, &tbx, &tby, &tbw, &tbh);
|
|
|
|
// center bounding box by transposition of origin:
|
|
|
|
uint16_t x = ((display.width() - tbw) / 2) - tbx;
|
|
|
|
uint16_t y = ((display.height() - tbh) / 2) - tby;
|
|
|
|
display.setFullWindow();
|
|
|
|
display.firstPage();
|
|
|
|
do
|
|
|
|
{
|
|
|
|
display.fillScreen(GxEPD_WHITE);
|
|
|
|
display.setCursor(x, y);
|
|
|
|
display.print(HelloWorld);
|
|
|
|
}
|
|
|
|
while (display.nextPage());
|
|
|
|
//Serial.println("helloWorld done");
|
|
|
|
}
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
|
|
// initialize LED digital pin as an output.
|
|
|
|
pinMode(LED_BUILTIN, OUTPUT);
|
|
|
|
|
|
|
|
display.init(115200);
|
|
|
|
helloWorld();
|
|
|
|
display.powerOff();
|
|
|
|
|
|
|
|
wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD);
|
|
|
|
wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2);
|
|
|
|
|
|
|
|
Serial.println("Connecting Wifi...");
|
|
|
|
if(wifiMulti.run() == WL_CONNECTED) {
|
|
|
|
Serial.println("");
|
|
|
|
Serial.println("WiFi connected");
|
|
|
|
Serial.println("IP address: ");
|
|
|
|
Serial.println(WiFi.localIP());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
if(wifiMulti.run() != WL_CONNECTED) {
|
|
|
|
Serial.println("WiFi not connected!");
|
|
|
|
delay(1000);
|
|
|
|
}
|
|
|
|
}
|