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?

M5Stamp S3でSerial.print()

Last updated at Posted at 2025-05-31

M5Stamp S3では、

Serial.begin(115200); 
 :
Serial.println("hoge");

ではなく

USBSerial.begin(115200); 
 :
USBSerial.println("hoge");

のようにする必要があります。

追記:開発環境や使用ライブラリによってはSerialのままでも大丈夫のようです

PlatformIOで行う場合は、

platform.ini
[platformio]
default_envs = m5stack-stamps3

[env:m5stack-stamps3]
platform = espressif32
board = m5stack-stamps3
framework = arduino
build_flags = -D INI_STAMPS3
monitor_speed = 115200
 :

INI_STAMPS3を定義した後、

main.ino
#ifdef INI_STAMPS3
  #define Serial USBSerial
#endif

 :
  Serial.begin(115200); 
 :
  Serial.println("hoge");
 :

のようにしておくと他のボードと共通のソースを使用できるので便利です。

関連

0
0
2

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?