[solved] M0 serial println doesn't work, unlike programming

Hello, I tried to send out text via serial to the computer with the M0.
Programming apparently works, since the LED is blinking after uploading the blink-example.
When I open the serial window of the Arduino IDE, the board either restarts and then opens another tty-port or the window opens but prints nothing. Buad rate set to 9600.

Here's my code:

void setup() {
  // initialize digital pin 13 as an output.
  //while (!SerialUSB);
  Serial.begin(9600);
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  Serial.println("turned LED on");
  Serial.flush();
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  Serial.println("turned LED off");
  delay(1000);              // wait for a second
}

I'm running Ubuntu Gnome 16.04 and did all the setup from this site already: arduino-ide-on-linux-based-os
except step 5.

I would be very thankful for any help, googled a lot already...
StrawHat

strawhat:
Hello, I tried to print out via serial with the M0.

I have no clue what that means.

Which m0 board are you using?

"print" -> Serial.println()

I'm using the non-pro M0 R3.

I'm using the non-pro M0 R3.

Are you using the Arduino.org IDE as well? I don't know if that board is supported by the arduino.cc IDE.
If it is, it's probably equivalent to the using the "Zero with native USB port" rather than "Zero with programming port" board type, and it MIGHT name the pc-connected serial port "SerialUSB" rather than just "Serial" (that's what my Sparkfun SAMD21 board does; "Serial" is the UART connected to D0/D1, and SerialUSB is the connection to the PC.)

Thank you so much!!!

using SerialUSB.println("turned LED on"); instead of Serial.println("turned LED on"); did the job. Now I see the output in the console.
And yes, I'm using the IDE from the arduino.cc website. In the board selection is only one option for the M0, so I picked that one.

StrawHat

Thanks for that. Serial monitor, or rather SerialUSB monitor, now working normally on my new M0 board. :slight_smile: