No serial monitor on several sketch

I’m having a lot of trouble displaying data in serial monitor (arduino ide or platformio) when using xiaos.
Compiling and uploading goes well but the serial monitor does not display anything unlike other arduino targets.

This happens especially with MySensors libraries or some Grove libraries like the “MutichannelGasSensor”.

Do you see where this can come from? I have about twenty xiao which all have the same behavior.

Thank you for your comeback.

Since you didn’t post any code, I have to ask how could we see “where this can come from.”
My suggestion:
Try a very simple sketch that doesn’t do much other than some serial output. If that doesn’t work, post the code. Maybe someone can help.

If the simple sketch works, then add some functionality that does more. Maybe using an external library or some such thing.
If that doesn’t work and you can’t figure it out, then, post it and maybe someone can help.

I attached a simple Arduino sketch and the output from my XIAO that I see (along with the LED giving a brief flash every two seconds).


Dave (1.4 KB)



Thanks for your feedback. What I don’t understand is that simple sketches work and if I take a more complicated sketch (for example using an I2C grove MutichannelGasSensor) then the sketch hangs and no more serial data is displayed.

Here is an example sketch not working (this is the sensor example sketch)

#include "Arduino.h"

#include "MutichannelGasSensor.h"

#define SENSOR_ADDR     0X08        // default to 0x04

void setup()



    Serial.println("Port série démarré");


    Serial.println("Capteur démarré");

    unsigned char version = gas.getVersion();

    Serial.print("Version = ");



void loop()


    // nothing to do




First of all, with boards like the XIAO that do not have an external usb-to-serial chip, I always make the Serial initialization something like this:

    while (!Serial); // Note the semicolon here. Wait for serial terminal connection

With this change, I think you should at least see your first message. (At least I do on my XIAO.)
(See footnote)

Then: I don’t have one of those neat little devices, so I can’t tell you for sure what will work.


I can tell you a couple of things that might keep it from working (assuming that the device itself is OK):

  1. You don’t have the device connected properly (SCL, SDA, Power, Ground);


  1. . You are not using the correct I2C Device address.

Note that if either failure condition exists, your gas.begin() will get hung up waiting for a response from the device.

I note that the 7-bit I2C device address is 0x04, but you are using 0x08. The example code on the Seeed page and examples in the library all use 0x04.

If you change your code to use 0x04 and it still doesn’t work, then there’s not much more that I can do to help. It’s really tough to debug this kind of thing by long distance. And it’s hard to do in person without an oscilloscope.



Footnote: Without this change (putting while(!Serial);) , the program proceeds to get caught in a tight loop trying to read information from the device, and can’t print out the stuff your Serial.println() has previously put into a buffer.

A more developer-friendly library would put a time-out in the I2C access function calls and return a time-out error condition so that calling programs could detect failures to communicate. (This library is kind of amateurish, as are a LOT of programs of this kind, and make development unnecessarily frustrating.)