0
1

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.

M5Atom MatrixのArduino IDEでの書き込みを試す #m5stack #m5atom #ヒーローズリーグ

Last updated at Posted at 2020-09-19

ライブラリなどは入れた後の話でシンプルなコードをメモ

左上のLEDをつける

# include "M5Atom.h"

void setup(){
    M5.begin(true, false, true);
}

void loop(){
    M5.update();
    
    M5.dis.drawpix(0, 0xf00000);
}

LEDを全てつける

# include "M5Atom.h"

void setup(){
    M5.begin(true, false, true);
}

void loop(){
    M5.update();

	for (int i = 0; i < NUM_LEDS; i++){
    	M5.dis.drawpix(i, 0xf00000); //緑
   }
}

ボタン押してLEDを切り替え

赤と緑が切り替わります。

# include "M5Atom.h"

int flag = true; //ボタン管理フラグ

void setup(){
    M5.begin(true, false, true);
}

void loop(){
    M5.update();
    
    if (M5.Btn.wasReleased()) {
      
      if(flag){
        Serial.println("Button pressed 1");
        
        for (int i = 0; i < NUM_LEDS; i++){
           M5.dis.drawpix(i, 0xf00000); //緑
        }

        flag = false;
      }else{
        Serial.println("Button pressed 2");
        
        for (int i = 0; i < NUM_LEDS; i++){
           M5.dis.drawpix(i, 0x00f000); //赤
        }

        flag = true;
      }
      
    }
}

メモ: M5.dis.fillpixの使い方がいまいち分からない

M5.dis.fillpix(0xf00000);こういう指定じゃないっぽいんですよね。うーむ。

has no member named 'fillpix'的なエラーが出て解決できてない。

M5.dis.fillpix(0xf00000);
              ^
exit status 1
'class LED_Display' has no member named 'fillpix'
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?