Wondering if someone can help me understand what is going on with the code below??
// This seems to ignore the pinMode statement but commenting out the while statement below works fine.
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.
Yes thats right.
The code lines
let the Due what until there is an USB connection between Due and PC. If you use the programming port and set this line
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.
Vice versa for both ports.