Off topic... Bang goes my theory that the forum only shows a post as updated if it knows someone else could have read it before it was changed. Must be based on timing or some other criteria.
What difference does printing from setup make? loop is already printing ? Anyways I tried adding print in setup, the statement doesn't show up in Serial Monoitor.
Changed rate to 115200, makes no difference.
Added delay(1000) in setup, makes no difference.
Board is Seeed XIAO RP2040. I tried in the emulator, indeed works as expected. Can the board be a problem? Can anyone try on a board please?
Try putting the following in setup after the Serial.begin()
while (!Serial); //wait for USB-to-Serial connection to be established
Alternatively, if there is a reset button on the board, try pressing that and see if you get the correct output in the Serial monitor. Some boards do not properly reset when the USB connection is established.
Many types of Arduino get automatically reset when you open serial monitor, so what you see are the very first things printed after it starts up. But not all types of Arduino do that.
For example, when I use a usb-serial adapter to upload code to an esp-01 module, I have to reset the chip and put it it programming mode by pressing pushbuttons, before I click Upload in the IDE. Then I have to press the reset button after upload has completed to get the code to run. When I open serial monitor, it does not automatically reset the chip, so the text I see on serial monitor is not the first text to be printed.
I have added serial statements just to simplify the usecase. The actual code does not use Serial, but does a one time mouse movement based on value of a global variable isMouseInit. But the sequence is never executed.