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?

はじめに

この記事は、M5Stack CoreInkのサンプルを動かした際のメモとして書いたものです。

M5Stack CoreInkとは

  • M5Stack CoreInk サンプル

M5Stack CoreInkのサンプルを動かす

まずは、開発環境を整えます。

Arduino IDEのインストール

こちらより、ダウンロードしてインストールしてください。
インストール方法は色々と他記事があるのでここでは解説しません。

ドライバ・開発環境の導入

こちらの公式手順に沿って構築してください。
ライブラリのインストールまで済んだら、サンプルスケッチを試してみます。

まぁ、公式の手順に沿っていけば開発環境の構築は難しくないと思います。

Hello World

開発環境の準備ができたらサンプルの Hello World を試してみたいと思います。

Arduino IDEで新規スケッチを開き、下記のコードを記述します。


#include "M5CoreInk.h"

Ink_Sprite InkPageSprite(&M5.M5Ink);
/* After CoreInk is started or reset
the program in the setUp () function will be run, and this part will only be run once.
*/
void setup() {

    M5.begin(); //Init CoreInk.
    if( !M5.M5Ink.isInit()) //Init CoreInk screen.
    {
        Serial.printf("Ink Init faild");
        while (1) delay(100);
    }
    M5.M5Ink.clear();   //Clear screen.
    delay(1000);
    if( InkPageSprite.creatSprite(0,0,200,200,true) != 0)   //Create a sprite.
    {
        Serial.printf("Ink Sprite creat faild");
    }
    InkPageSprite.drawString(35,50,"Hello World!"); //Draw a string.
    InkPageSprite.pushSprite(); //Push the sprite to the screen.
}
/* After the program in setup() runs, it runs the program in loop()
The loop() function is an infinite loop in which the program runs repeatedly
*/
void loop() {

}

上記のサンプルスケッチを保存して、ボードとポートを選びます。

image.png

image.png

スケッチのアップロードと実行

image.png

Hello World!が表示されました!

PXL_20240122_131658955.MP.jpg

とりあえず無事にサンプルが動くことを確認できました。
次回はMQTTのサンプルを動かしてみたいと思います。

  • MQTTサンプル

その他

アップロードに失敗することがあります。その際にはTools->Upload Speedを変更してみてください。
たまに921600とかになっていて失敗することがあります。

image.png

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?