6 Replies Latest reply on Apr 5, 2016 9:17 PM by FGT

    WebClient Example does not compile

    hegedus@alum.mit.edu

      I am starting up with a Gen 2 board and for the most part it is working as expected.

       

      I am attempting to work with the ethernet port and have been using the WebClient as a testing sketch.

       

      I am using the Ethernet(Galileo) WebClient as the working sketch.

       

      When I verify the sketch as is, I get a "Error Compiling" with no additional information in the console.  The only message of any interest is:

      Multiple libraries were found for "Ethernet.h"

      Used: /Users/andreashegedus/Documents/Arduino/libraries/Ethernet

      Not used: /Users/andreashegedus/Library/Arduino15/packages/Intel/hardware/i586/1.6.7+1.0/libraries/Ethernet

      Not used: /Applications/Arduino Galileo.app/Contents/Java/libraries/Ethernet.

       

      Where do I go from here?

       

      NOTE: Book I read recommended an addition to the setup function:

           system("ifup eth0");

           delay(3000);

       

      I tried it both ways and still get the error compiling message.

       

      *

        Web client

       

      This sketch connects to a website (http://www.google.com)

      using an Arduino Wiznet Ethernet shield.

       

      Circuit:

      * Ethernet shield attached to pins 10, 11, 12, 13

       

      created 18 Dec 2009

      modified 9 Apr 2012

      by David A. Mellis

       

      */

       

       

      #include <SPI.h>

      #include <Ethernet.h>

       

       

      // Enter a MAC address for your controller below.

      // Newer Ethernet shields have a MAC address printed on a sticker on the shield

      byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

      IPAddress server(173,194,33,104); // Google

       

       

      // Initialize the Ethernet client library

      // with the IP address and port of the server

      // that you want to connect to (port 80 is default for HTTP):

      EthernetClient client;

       

       

      void setup() {

      // Open serial communications and wait for port to open:

        Serial.begin(9600);

         while (!Serial) {

          ; // wait for serial port to connect. Needed for Leonardo only

        }

       

       

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

        Serial.println("connecting...");

       

       

        // if you get a connection, report back via serial:

        if (client.connect(server, 80)) {

          Serial.println("connected");

          // Make a HTTP request:

          client.println("GET /search?q=arduino HTTP/1.0");

          client.println();

        }

        else {

          // if you didn't get a connection to the server:

          Serial.println("connection failed");

        }

      }

       

       

      void loop()

      {

        // if there are incoming bytes available

        // from the server, read them and print them:

        if (client.available()) {

          char c = client.read();

          Serial.print(c);

        }

       

       

        // if the server's disconnected, stop the client:

        if (!client.connected()) {

          Serial.println();

          Serial.println("disconnecting.");

          client.stop();

       

       

          // do nothing forevermore:

          for(;;)

            ;

        }

      }

        • 1. Re: WebClient Example does not compile
          FGT

          Hi,

           

          Similar problem has been reported by others which had several Arduino IDE versions,

           

          https://communities.intel.com/message/379713#379713

          Re: Multiple libraries were found on ethernet.h

           

          do you have multiple IDE versions?

           

          Maybe erasing every IDE and installing from scratch would work.

           

          HTH,

           

          Fernando.

          • 2. Re: WebClient Example does not compile
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi hegedus@alum.mit.edu,

             

            I've just compiled the WebClient example without issues. I recommend you to follow the FGT's suggestion. Additionally, I prefer using the executable version of the IDE instead of the one you have to install. I have never had issues with the executable versions of the IDE, so you could try using the executable version as well.

             

            Regards,
            Diego

            • 3. Re: WebClient Example does not compile
              hegedus@alum.mit.edu

              Progress but not success.

               

              I checked my system, I am on a Mac, and there was a folder in the user/library/ folder named Arduino15 and there was a folder in the user/documents/ called Arduino and in it was also a folder named library.  I deleted both and reinstalled from the Intel site.

               

              I open the web client example and it compiles, good.  But I am still not successful in connecting. I have the Galieo ethernet cable going to my Airport extreme basestation and connected to a lan port.  Unfortunately the Apple Airport Utility no longer displays wired connections only wireless.

               

              When I run in the serial monitor it says

              "connecting"

               

              and then

               

              "connection failed" so the setup function was not successful.

               

              Any hints?

              • 4. Re: WebClient Example does not compile
                FGT

                hegedus@alum.mit.edu wrote:

                 

                Progress but not success.

                 

                I checked my system, I am on a Mac, and there was a folder in the user/library/ folder named Arduino15 and there was a folder in the user/documents/ called Arduino and in it was also a folder named library.  I deleted both and reinstalled from the Intel site.

                 

                I open the web client example and it compiles, good.  But I am still not successful in connecting. I have the Galieo ethernet cable going to my Airport extreme basestation and connected to a lan port.  Unfortunately the Apple Airport Utility no longer displays wired connections only wireless.

                 

                When I run in the serial monitor it says

                "connecting"

                 

                and then

                 

                "connection failed" so the setup function was not successful.

                 

                Any hints?

                It seems to be that the server is not reachable... i.e. either there is not a web server with IP 173.194.33.104 or you can't reach it (routing problem, beyond Galileo). 

                 

                From my computer I can't connect to http://173.194.33.104/, can you? If not, then there is no server with that IP ... use another one... I can use  216.58.202.14 (another IP for some google server) and it works... thus, you should use

                     IPAddress server(216,58,202,14); // Google ... or some reachable web server

                instead of (your current line)

                    IPAddress server(173,194,33,104); // Google

                As the comment says, you can use any reachable web server IP.

                 

                HTH,

                 

                Fernando.

                • 5. Re: WebClient Example does not compile
                  hegedus@alum.mit.edu

                  Swapped IP address. That Worked.

                   

                  Thank You Fernando!

                   

                  Andy

                  • 6. Re: WebClient Example does not compile
                    FGT

                    You're welcome, and congratulations, you have it working.

                     

                    Fernando.