Go Down

Topic: SerialUSB.print() in Output (Read 2 times) previous topic - next topic

Wilsonator

Mar 29, 2013, 10:41 pm Last Edit: Mar 29, 2013, 10:51 pm by Wilsonator Reason: 1
Hi I am having trouble getting the DUE to output any serial information during the setup loop. I also want to understand better the 'soft erase' procedure.

In the arduino documentation (http://arduino.cc/en/Guide/ArduinoDue):
"Opening and closing the Native port at a baudrate other than 1200bps will not reset the SAM3X. To use the serial monitor, and see what your sketch does from the beginning, you'll need to add few lines of code inside the setup(). This will ensure the SAM3X will wait for the SerialUSB port to open before executing the sketch:
while (!Serial) ;"

I assume when I upload a sketch that the Arduino IDE handles the soft erase procedure in the background? Would this be a correct assumption?

Also I cannot get any output to print to serial monitor from the setup loop I have tried the following so far to no avail:

Code: [Select]

setup() {
while(!Serial); //Tried while(!SerialUSB); as well
SerialUSB.begin(9600); //Doesn't matter speed

SerialUSB.print("Hello World");
}


As well as:
Code: [Select]

setup() {
SerialUSB.begin(9600); //Doesn't matter speed
while(!Serial); //Tried while(!SerialUSB); as well

SerialUSB.print("Hello World");
}


Can anyone tell me how I can get my setup to properly print to serial monitor when I first load it up (the same way the old atmel atmega chips would print every time you opened serial monitor).

stimmer

#1
Mar 29, 2013, 10:47 pm Last Edit: Mar 29, 2013, 10:49 pm by stimmer Reason: 1
It looks like it should say:

while(!SerialUSB);   

and it should come after SerialUSB.begin(9600);

Wilsonator


It looks like it should say:

while(!SerialUSB);   

and it should come after SerialUSB.begin(9600);


Tried this as well, update original post to reflect this.

No luck.

Wilsonator

Still having problems with this. Anyone know a solution?

ageurtse

Maybe a stupid question but did you hook up your usb kabel on the native usb port, not the programming port.


Go Up