0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

M5Paper で WiFi 接続

0
Last updated at Posted at 2022-06-03

こちらの記事を参考にしました。
M5Paperでウェブサイトを表示する node.js 版
WiFi 接続をして、ネット上の png ファイルをダウンロードして、表示するプログラムです。

IMG_20220603_132939.jpg

SSID
PASSWORD
は、書き換えて下さい。

wi_fin.ino
// ---------------------------------------------------------------
//  wi_fi.ino
//
//              Jun/03/2022
// ---------------------------------------------------------------
#include <M5EPD.h>
#include <WiFi.h>

#define SSID "*****************"
#define PASSWORD "**********"

#define URL_PNG "https://ekzemplaro.org/png/linux_logo.png"

M5EPD_Canvas canvas(&M5.EPD);


// ---------------------------------------------------------------
void setup()
{
    char buf[80];
    M5.begin();
    M5.EPD.SetRotation(0); 
    M5.EPD.Clear(true);

    WiFi.begin(SSID, PASSWORD);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }

    canvas.createCanvas(960, 540);
    canvas.setTextSize(3);

     sprintf(buf, "URL %s", URL_PNG);
    canvas.drawString(buf , 20, 400);
        canvas.pushCanvas(0,0,UPDATE_MODE_GC16);
       
    canvas.drawPngUrl(URL_PNG);

    canvas.pushCanvas(0,0,UPDATE_MODE_GC16);
// 10秒待つ。失敗する様であれば調整
    delay(10000);
// 3時間おきに実行
    M5.shutdown(10800);

}

// ---------------------------------------------------------------
void loop()
{
}

// ---------------------------------------------------------------
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?