void setup(){ // This seems to ignore the pinMode statement but commenting out the while statement below works fine. while (!SerialUSB); pinMode(13, OUTPUT);}

void loop(){ digitalWrite(13, LOW);}

When changing the line above to "while (!Serial);" it works just as if it was commented out entirely. I read somewhere that you should put while (!Serial); in your setup as a first step to ensure the serial port hardware is initialized before doing anything else with it. Wouldn't this also be the case for SerialUSB when using the native USB port??

If the while statement on SerialUSB is used at all the digitalWrite statement has no effect and LED always stays on.

void setup(){ // This seems to ignore the pinMode statement but commenting out the while statement below works fine. while (!SerialUSB); pinMode(13, OUTPUT);}

void loop(){ digitalWrite(13, LOW);}

When changing the line above to "while (!Serial);" it works just as if it was commented out entirely. I read somewhere that you should put while (!Serial); in your setup as a first step to ensure the serial port hardware is initialized before doing anything else with it. Wouldn't this also be the case for SerialUSB when using the native USB port??

If the while statement on SerialUSB is used at all the digitalWrite statement has no effect and LED always stays on.

while (!Serial);The Due will walk over this line while the USB is connected but if you connect after the programming the due with the nativ USB-Port nothing will happend the Due waits for an plugin in the programming port.

Ahh, duh. That makes sense. I am using native USB in production and programming in development. I was under the impression it was waiting for initialization of the internal controller and not an actual connection to an end-point/host. Makes perfect sense. Thank you very much!