Arduino Yun WebClient Examples

Hello - I was wondering if I could get some help with my Yun regarding the WebClient code example. My Yun is connected by Ethernet and I can see it on the router and access it using a browser.

When running the WebClient example, I get the "Failed to configure Ethernet using DHCP" message, then "connecting..." forever. As far as I can tell it is not getting out of setup().

There is a related code example here:
http://playground.arduino.cc/Code/WebClient
but this just hangs Java and the IDE locks up.

I have used IDE 1.6.6 and also tried 1.6.5.r5. The Yun is an Arduino.cc device. Thanks.

That code will not work on the Yun, it is intended for a more traditional Arduino with an Ethernet shield. The Yun uses a completely different philosophy for networking. Basically, if the sketch you are looking at includes Ethernet.h or WiFi.h, it simply will not work with the Yun.

The equivalent example sketch you want to be looking at is HttpClient example. compare the code, see how much simpler it is? The code you are trying manages all of the networking using the sketch and the limited resources of the AVR processor. The Yun version does all of the networking management using the Linux processor - this makes the networking much more powerful, and greatly simplifies the sketch, leaving more of the limited AVR resources for use by a more complicated sketch.

Thank you for the help, I appreciate it. I tried running the HTTPClient code that comes as an example in the Arduino 1.6.6 IDE. As opposed to getting the Arduino logo, I originally got:

301 Moved Permanently

301 Moved Permanently


nginx/1.4.2

After reading about this on the forum (more below), I tried the code on the web (https://www.arduino.cc/en/Tutorial/HttpClient) which makes the substitution:
client.get("http://arduino.cc/asciilogo.txt");

This code does run for me.

The forum link is here:
http://forum.arduino.cc/index.php?topic=317430.0

What seems to have happened is that the poster in this other thread noted a problem. The solution got propagated into the example in the IDE but did not get propagated to the link at https://www.arduino.cc/en/Tutorial/HttpClient

Then the original server issue was resolved and now the "old" web code works and the "new" IDE code is broken.

I mention all of this to show my appreciation for the help and also to assist the moderators/developers in reverting the change in the IDE for the next IDE release.

Sometimes I am not very clear so if I haven't been clear here, let me know and I will elaborate if I can be of help.

Arduino Logo move to https (asciilogo.txt)

client.noCheckSSL();

Plan B:

Install root certificate and remove root certificate error.

sonnyyu:
HttpClient use curl, and curl need root CA install, to support HTTPS POST ( as well as GET) , The root CA is needed.

wget -O ca-certificates_20140325_ar71xx.ipk https://www.dropbox.com/s/rmvkunea1ifa9zn/ca-certificates_20140325_ar71xx.ipk?dl=0 --no-check-certificate
opkg update

opkg install openssl-util
opkg install ca-certificates_20140325_ar71xx.ipk




I compile ca-certificates for get rid of "--no-check-certificate" at wget.