3 Replies Latest reply on Dec 7, 2013 2:29 AM by AlexT_Intel

    Problems with Web Client Example

    Daniel_F11X

      .

        • 1. Re: Problems with Web Client Example
          AlexT_Intel

          Hi Daniel. I've just tried it - the sketch is [almost] fine, there are just a couple of surplus lines. There's also potentially some setup needs to be done on the router side, but let's tackle this step by step. We'll get it it running for you, I'm sure :-)

           

          The result of my try:

          ---------

          connecting...

          connected

          HTTP/1.0 200 OK

          Date: Thu, 05 Dec 2013 20:21:23 GMT

          Expires: -1

          Cache-Control: private, max-age=0

          Content-Type: text/html; charset=ISO-8859-1

          <cut>

          ---------

           

          First, the sketch. As long as Galileo has "real" Ethernet, not a shield, you don't need the following lines - it's like having an Ethernet shield always enabled and initialized.

           

          -------

          #include <SPI.h>

          byte mac[] = { 0x00, 0x13, 0x20, 0xFF, 0x11, 0xF1 }; // Arduino's artificial mac address

           

          // 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(;;)

                ;

            }

            // give the Ethernet shield a second to initialize:

            delay(1000);

          -------

          Here's the full copy of your example with these surplus lines commented out: http://pastebin.com/daSCPgV6, you can just copy'n'paste'n'run it.

           

          Now the router part. Generally, all you need to have is:

          1) DHCP enabled on your router, so that it gives out the IP address to the board (if you have any access control enabled, e.g. based on MAC addresses, you'd need to add board's MAC into the whitelist);

          2) Ethernet cable inserted into the board before you power it on (currently it only tries to get the IP once during boot, after that you'd need to run some additional command to get it);

           

          You can typically look into the router's log to see if it has given the IP away. You can also run a sketch with the below command to see if it's got an IP:

           

          -------

          system("ifconfig -a > /dev/ttyGS0")

          -------

           

          If your router supports that and you're familiar enough with its configuration process, you could configure the router to give out the specific predefined IP to the board (not an arbitrary one from the pool) - that way it would be easier for you to check the above and connect to it using SSH should you want to.

           

          I think that should get you going (a lot of text - sorry :-) ), please post the results you get and we'll go from that.

           

          EDIT: Updated the Pastebin link, there's one typo slipped through - sorry for that

          • 3. Re: Problems with Web Client Example
            AlexT_Intel

            Glad to read that. It worked with that address for me, which AFAIU resolves into some Seattle based server of Google's. Maybe there are some differences between your and my ISP, which account for such inability to connect using this IP.