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.

M5Stack Core2: shutdown の使い方

Last updated at Posted at 2023-02-13

M5Stack Core2 をプログラムでシャットダウンする方法です。
仕様
CORE2 API System

このプログラムを使えば、電源を落として、充電が出来ます。

プログラム

image.png

shutdown.ino
// ---------------------------------------------------------------
/*
	shutdown.ino

					Feb/13/2023
*/
// ---------------------------------------------------------------
#include <M5Core2.h>

// ---------------------------------------------------------------
void setup() {
	M5.begin();
	M5.Lcd.setBrightness(32);
	M5.Lcd.fillScreen(WHITE);
	delay(200);

	draw_five_circles();
	delay(500);
}						 


// ---------------------------------------------------------------
void draw_five_circles()
{
	int tt = 200;
	draw_circle_proc(60,120,BLUE);
	delay(tt);
	draw_circle_proc(160,120,BLACK);
	delay(tt);
	draw_circle_proc(260,120,RED);
	delay(tt);
	draw_circle_proc(110,170,YELLOW);
	delay(tt);
	draw_circle_proc(210,170,GREEN);
	delay(tt);
}

// ---------------------------------------------------------------
void draw_circle_proc(int xpos,int ypos,uint16_t color)
{
	for (int it=0; it< 10; it++)
		{
		int rr = 41 + it;
		M5.Lcd.drawCircle(xpos, ypos, rr, color);
		}
}

// ---------------------------------------------------------------
void loop()
{
	M5.Lcd.setTextColor(MAGENTA);
	M5.Lcd.setTextSize(5);
	M5.Lcd.clear(WHITE);
	draw_five_circles();
	M5.Lcd.drawString("TOKYO 2020",15,10,1);
	delay(3000);
	M5.Lcd.clear(WHITE);
	draw_five_circles();
	M5.Lcd.drawString("PARIS 2024",15,10,1);
	delay(3000);
	M5.shutdown();
}

// ---------------------------------------------------------------

シャットダウンは、
M5.shutdown(); で行います。

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?