Go Down

Topic: Delay is required for running DhcpAddressPrinter on Due (Read 291 times) previous topic - next topic

Hi all,

just sharing my experience here. Due won't print anything unless you
add Delay() after serial.begin()

as stupid as it sounds, this info might help others.

BR
Owen

Code: [Select]
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // this check is only needed on the Leonardo:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  delay(1000);
  delay(1000);
  delay(1000);
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for (;;)
      ;
  }
  // print your local IP address:
  Serial.println("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.println(Ethernet.localIP()[thisByte], DEC);
    Serial.println(".");
  }
}

void loop() {
  // print your local IP address:
  Serial.println("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.println(Ethernet.localIP()[thisByte], DEC);
    Serial.println(".");
  }
  while(1);
}


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy