I've had this problem for years. Years ago I was forced to downgrade the project to using an Arduino Nano. I was hoping it was fixed by now, but no. This exact same code works fine on a NANO, I see blinking and I get output on the serial monitor. Try it on a DUE and I see the blinking, but NO output on the serial monitor. We in the community would like to be able to use the DUE but it seems we are being throttled. I use pins 20/21 on the DUE and A4/A5 on the NANO. Ultimately I want to connect to the 9250 but cannot communicate with that using a DUE, but can with a NANO, but subsequent processing is slower and not feasible.
int cntr={0};
void loop()
{
Serial.println(cntr++);
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
It's the standard blink example with a simple print command.
I am using the Native USB port. When I try to use the programming port I get a message about no device found. Previous research led discussions about being because of an incorrect resistor value at R23. Rather than try the "solder a 1k surface mount resistor" fix I just use the Native port. I cannot solder that small. Yes, board and port (native) are selected in the IDE.
It seems that you have to load the code over the programming port and then switch to the native port for running the code on the native port.
This is what the setup function should be:-
//Serial.begin(115200); // don't do this if you want to use the native port for the faster direct USB connection.
SerialUSB.begin(115200); // Initialize Native USB port
while(!SerialUSB); // Wait until connection is established
It seem you can't program the Due over the native port.