Skip to main content
Arduino

Return to Answer

Commonmark migration
Source Link

Which one are you using?

The one closest to the reset button, I believe its the native...

This is more confusing than I realized. The Due has two ports:

Due ports


Programming port

For programming, the programming port is easiest to use. And you can "talk" to the serial port using Serial, like this:

void setup ()
 {
 Serial.begin (115200);
 Serial.println ("Hello, world!");
 } // end of setup
void loop ()
 {
 } // end of loop

Native USB port

This lets you emulate USB devices (eg. keyboard, mice). However if you want to use it for Serial communications you need to use a different class SerialUSB like this:

void setup ()
 {
 SerialUSB.begin(115200);
 while (!SerialUSB) ; // wait for it to become ready
 SerialUSB.println ("Starting ...");
 } // end of setup
unsigned long i;
void loop ()
 {
 SerialUSB.print ("Hello, world! Count = ");
 SerialUSB.println (++i);
 delay (1000);
 } // end of loop

It also helps to wait for the serial port to become ready, as I did in setup. Otherwise you may miss the first 10 lines or so of serial output.

Which one are you using?

The one closest to the reset button, I believe its the native...

This is more confusing than I realized. The Due has two ports:

Due ports


Programming port

For programming, the programming port is easiest to use. And you can "talk" to the serial port using Serial, like this:

void setup ()
 {
 Serial.begin (115200);
 Serial.println ("Hello, world!");
 } // end of setup
void loop ()
 {
 } // end of loop

Native USB port

This lets you emulate USB devices (eg. keyboard, mice). However if you want to use it for Serial communications you need to use a different class SerialUSB like this:

void setup ()
 {
 SerialUSB.begin(115200);
 while (!SerialUSB) ; // wait for it to become ready
 SerialUSB.println ("Starting ...");
 } // end of setup
unsigned long i;
void loop ()
 {
 SerialUSB.print ("Hello, world! Count = ");
 SerialUSB.println (++i);
 delay (1000);
 } // end of loop

It also helps to wait for the serial port to become ready, as I did in setup. Otherwise you may miss the first 10 lines or so of serial output.

Which one are you using?

The one closest to the reset button, I believe its the native...

This is more confusing than I realized. The Due has two ports:

Due ports


Programming port

For programming, the programming port is easiest to use. And you can "talk" to the serial port using Serial, like this:

void setup ()
 {
 Serial.begin (115200);
 Serial.println ("Hello, world!");
 } // end of setup
void loop ()
 {
 } // end of loop

Native USB port

This lets you emulate USB devices (eg. keyboard, mice). However if you want to use it for Serial communications you need to use a different class SerialUSB like this:

void setup ()
 {
 SerialUSB.begin(115200);
 while (!SerialUSB) ; // wait for it to become ready
 SerialUSB.println ("Starting ...");
 } // end of setup
unsigned long i;
void loop ()
 {
 SerialUSB.print ("Hello, world! Count = ");
 SerialUSB.println (++i);
 delay (1000);
 } // end of loop

It also helps to wait for the serial port to become ready, as I did in setup. Otherwise you may miss the first 10 lines or so of serial output.

Source Link
Nick Gammon
  • 38.9k
  • 13
  • 69
  • 125

Which one are you using?

The one closest to the reset button, I believe its the native...

This is more confusing than I realized. The Due has two ports:

Due ports


Programming port

For programming, the programming port is easiest to use. And you can "talk" to the serial port using Serial, like this:

void setup ()
 {
 Serial.begin (115200);
 Serial.println ("Hello, world!");
 } // end of setup
void loop ()
 {
 } // end of loop

Native USB port

This lets you emulate USB devices (eg. keyboard, mice). However if you want to use it for Serial communications you need to use a different class SerialUSB like this:

void setup ()
 {
 SerialUSB.begin(115200);
 while (!SerialUSB) ; // wait for it to become ready
 SerialUSB.println ("Starting ...");
 } // end of setup
unsigned long i;
void loop ()
 {
 SerialUSB.print ("Hello, world! Count = ");
 SerialUSB.println (++i);
 delay (1000);
 } // end of loop

It also helps to wait for the serial port to become ready, as I did in setup. Otherwise you may miss the first 10 lines or so of serial output.

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /