9
8

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 5 years have passed since last update.

M5StackでSerial.printができない問題 / もしくは115200bpsでのみ通信できる問題

Posted at

###任意のボーレートでシリアル通信できないコード

#include <M5Stack.h>
void setup() {
  Serial.begin(9600); //M5.begin()より前にSerialの初期化をしている
  M5.begin();  
}
void loop(){
  Serial.println("hello world");
  delay(100);
}

###任意のボーレートでシリアル通信できるコード

#include <M5Stack.h>
void setup() {
  M5.begin(); 
  Serial.begin(9600); //M5.begin()の後にSerialの初期化をしている
}
void loop(){
  Serial.println("hello world");
  delay(100);
}

###理由
M5.begin();の中でSerial.begin(115200);で初期化されていることが原因。
https://github.com/m5stack/M5Stack/blob/master/src/M5Stack.cpp

9
8
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
9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?