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 1 year has passed since last update.

M5Atom Liteで内蔵Lチカメモ(PlatformIO)#m5stack

Last updated at Posted at 2023-10-12

たまにやっていつも忘れるのでコピペで試せるようにメモ

スクリーンショット 2023-10-12 14.24.11.png

PlatformIOの設定

iniファイルはこんな感じ

platformio.ini
; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:m5stack-atom]
platform = espressif32
board = m5stack-atom
framework = arduino
lib_deps = 
	m5stack/M5Atom@^0.1.1
	fastled/FastLED@^3.6.0
monitor_speed = 115200

main.cpp

ロジカラブログさんの記事のコードをそのまま使わせてもらいました。コードの解説は本家を参照

main.cpp
#include <M5Atom.h>

CRGB dispColor(uint8_t r, uint8_t g, uint8_t b) {
  return (CRGB)((r << 16) | (g << 8) | b);
}

void setup() {
  M5.begin(true, false, true);
  M5.dis.drawpix(0, dispColor(0, 0, 0));
}

void loop() {
  M5.update();

  if (M5.Btn.isPressed()) {
    M5.dis.drawpix(0, dispColor(0, 0, 255));
  } else {
    M5.dis.drawpix(0, dispColor(20, 20, 20));
  }
  delay(100);
}

実行

☑️でコンパイル、で書き込みです。

スクリーンショット 2023-10-12 14.22.31.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?