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?

M5NanoC6、USBシリアルで遊ぶ。(知っていると思うけど!!!) ESP32 3.3.4

Posted at

目的

USBシリアルがなぜか上手く動かない時があるので対策をする。

理由

M5NanoC6をPCに挿した場合、M5NanoC6が正常に起動する時間と、
PCのドライバーがデバイスを認識する時間がかかる。
で、、、直ぐにUSBシリアルに出力をすると、なぜか、ジャムったり、
ハングアップしたりする。
「Serial.begin(9600);」の後に適度に待ち時間を入れるとなぜか、上手く行く。

結果

Screenshot from 2025-11-14 20-37-13.png

プログラム




#include <Arduino.h>

void setup() {
  // put your setup code here, to run once:

  //シリアルの初期化
  Serial.begin(9600);
  delay(3000);  //接続待ち
  Serial.println("");
  //シリアルの待ちが0.5*3
  for (int i = 0; i < 3; i++) {
    delay(500);  //接続待ち
    Serial.print(".");
  }  //for
  Serial.println("");

  //ここから本題を表示する。
  Serial.printf("HELLO WORLD");

  Serial.println("");
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(3);  //ダミー
}


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?