Pages: 1 [2] 3   Go Down
Author Topic: XML fetching question: Ethernet Shield  (Read 2112 times)
0 Members and 1 Guest are viewing this topic.
CH
Offline Offline
God Member
*****
Karma: 19
Posts: 703
Book Writer "Arduino Praxiseinstieg"
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why isn't my version working then?

@stuarthooper
What message do you see in the serial monitor.
Compare with my working example above.
You should check the ip address from the yahoo server. May be you have to use a different. Make a ping in the command box.

Quote
Your code appears to be "different" from the code I used. I suggest you try the code that worked for me to see if you have hardware issues or just issues with your code.
I provided 2 different ways and working sketches to read the yahoo weather xml.

1. My own solution from an other thread
http://arduino.cc/forum/index.php/topic,121992.msg920175.html#msg920175

2. The fixed version from stuarthooper that worked on my board.

Zoomkat is right. These are two different code example. He tested successful version 1 which uses the TextFinder Library.



Logged

CH
Offline Offline
God Member
*****
Karma: 19
Posts: 703
Book Writer "Arduino Praxiseinstieg"
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
// Ethernet
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x13, 0x1D };
byte ip[] = { 78,149,131,230 };
byte gateway[] = { 10, 0, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };
IP doesn't match to the gateway IP.

It looks like your client can't make a connection to the Yahoo server.

Can you check your example sketch "WebClient" from the ethernet library. With this sketch you should be able to get response from the google server. After successful run of the Webclient sketch you can copy the ethernet settings to you weather sketch.
Logged

CH
Offline Offline
God Member
*****
Karma: 19
Posts: 703
Book Writer "Arduino Praxiseinstieg"
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

All of these services weather or time send xml data.

As I showed you in a earlier post I was able to receive the time data.

I also think the problem is in the ethernet connection and configuration. Gateway and Subnet a optional.

Did you check the WebClient example?
Logged

Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, web client doesn't connect but my own sketch that sends and receives tweets using twitter client and the twitter library do work perfectly.
Logged

CH
Offline Offline
God Member
*****
Karma: 19
Posts: 703
Book Writer "Arduino Praxiseinstieg"
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What ethernet configuration did you use in your working sketch? Copy these to your webclient sketch.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try pinging that alleged google IP. I get no response. If I ping google.com, I get 173.194.43.6, which also brings up the google search page in a browser. Does that one work any better for you?
Logged

CH
Offline Offline
God Member
*****
Karma: 19
Posts: 703
Book Writer "Arduino Praxiseinstieg"
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It looks like your client can't make a connection with the external webserver. Did you check the IP of the website (www.worldweatheronline.com)?

Logged

Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes. The IP is correct.
Logged

CH
Offline Offline
God Member
*****
Karma: 19
Posts: 703
Book Writer "Arduino Praxiseinstieg"
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you get an XML when you enter the URL in your browser:

http://www.worldweatheronline.com//feed/tz.ashx?key=92b48f5ddc131933121209&q=london&format=xml
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
byte ip[] = {78,149,131,230 };

Is this really an address on your network?
Logged

Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I get this when I go to the URL

Code:
<data>
<request>
<type>City</type>
<query>London, United Kingdom</query>
</request>
<time_zone>
<localtime>2012-09-16 16:50</localtime>
<utcOffset>1.0</utcOffset>
</time_zone>
</data>

That is how I know to scan for <localtime>


Also my IP address is 78,147,235,111 but it doesn't work with either. Thanks for noticing that it was set wrong though. Sadly that didn't help however.

Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
my IP address is 78,147,235,111

That address is owned by Opal Telecom DSL. Are you saying your Arduino is directly internet facing, and not behind a router?
Logged

Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes it is behind a router. This IP works in my other sketch though.
Logged

Reading, Berkshire
Offline Offline
Full Member
***
Karma: 2
Posts: 132
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I got that IP by googling 'what is my IP?'.

I'm guessing that makes it my IP.
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

'What is my IP' will give you the external facing address of your router. You need to give your Arduino an address on the internal side of the router. They are usually in the 192.168 or 10.0 range. You need to find the address of your PC, to see what network address range to use.
Logged

Pages: 1 [2] 3   Go Up
Jump to: