Serial ineffective with m5stack GRAY?

Hello, I have an m5stack GRAY and I read various Arduino-IDE codes where Serial.print is used. In my case, using Serial doesn't seem to be effective at all neither to receive nor print data on the M5.Lcd. Is this normal ?

ex:
#include <M5Stack.h>
void setup() { M5.begin(); Serial.begin(115200);}
void loop() {
M5.Lcd.print(Serial.available()); //always 0
Serial.print("123"); // nothing shows on screen
}

I'm not familiar with your board. If the board has native USB, try if this improves the situation

#include <M5Stack.h>
void setup()
{
  M5.begin();
  Serial.begin(115200);
  while(!Serial);
}
void loop()
{
  M5.Lcd.print(Serial.available()); //always 0
  Serial.print("123"); // nothing shows on screen
}

Your topic has been moved to a more suitable location on the forum. See the stickies in Uncategorized - Arduino Forum why you should not post in "Uncategorized".

PS
Please use code tags when posting code.

Is enough to open Serial at 115209 bauds (and configure a few other things )

@edebonneuil
Try adding M5.Power.begin(); after M5.begin();

If you try any of these examples, do they work?

That was copied from OP's post :wink:

I had to lookup what a Gray was. It seems like M5Stack Gray is an M5Core with a built-in IMU. This is a snippet from my setup() for an M5Stack Tough:

  M5.begin(/* LCDEnable */ true, /* SDEnable */ false, /* SerialEnable */ true, /* I2CEnable */ true);
  M5.Lcd.fillScreen(WHITE);  
  M5.Lcd.setTextColor(BLACK);
  M5.Lcd.setTextSize(3); 
  M5.Lcd.setRotation(3);
  M5.Lcd.setCursor(50, CENTER_Y);
  M5.Lcd.printf("Initializing"); 
  Serial.println("Ready");

Calling begin() will initialize both the LCD and Serial port, IIRC.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.