The Icehockey Feed

Hello, I'm quite new to arduino and have already taken water over my head. I'm trying to create a feed that will make two different LEDs light up every time Sweden or Canada scores in the Vancouver 2010 Icehockey Olympics. It sounds difficult doesn't it? It's not only finding a xml that will have the correct information but also how to code it properly. Well if anyone out there has any ideas of how to make that work I would be very happy!

I'm trying to create a feed that will make two different LEDs light up every time Sweden or Canada scores in the Vancouver 2010 Icehockey Olympics.

Are you trying to CREATE a feed, or read one?

It sounds difficult doesn't it?

Not particularly, if you are trying to read an RSS feed that someone else is producing. It might be, if you are creating one.

It's not only finding a xml that will have the correct information but also how to code it properly.

Finding one will be the hard part. Writing code to parse it will be easy.

Hi,

I had a similar idea, but had it on the back burner. If you can find a feed, or a website that is updated regularly, the rest we can do relatively easy.

If you want to give this a try now, with an NHL team, for example, I can help with the code Arduino communication if you can find a feed to work with.

Hello! and thank you, me and my mates are working on finding a feed that gives the information but it is hard. Many of them contain the info but not in a direct way that can be directly used. When we do we'll get back to you, the Icehockey fans of Edinburgh College of Art thank you!

Many of them contain the info but not in a direct way

Some parsing may solve that problem.

Will a PC be involved? Will the Arduino (using an Ethernet shield) collect the data?

Sweden Canada Vancouver 2010 Icehockey Olympics Icehockey fans of Edinburgh College of Art

So you're a Scot rooting for Canada playing hockey against Sweden?

I faced a similar problem when I wanted to get the Arduino to display weather information - having it scrape a weather forecast web site and do the parsing itself seemed a bit daunting. What I did is put an intermediary PHP script on a webserver, have the Arduino request that script instead and that script grabbed the weather forecast page and did some parsing in order to return a simple string to the Arduino. The PHP script used a library called simple_html_dom (http://simplehtmldom.sourceforge.net/ ) in order to parse the weather forecast page, and was very simple to write. Here’s the PHP code:

<?php
include_once('simple_html_dom.php');

// create HTML DOM
$html = file_get_html('http://news.bbc.co.uk/weather/forecast/2201?printco=Next12Hours&temp=centigrade');

$timeblocks = $html->find('div[class=times]', 0);
$timeblock = $timeblocks->find('div[class=time]');

foreach($timeblock as $block) {
      echo trim($block->find('h3', 0)->plaintext);                // time
      echo " ";
      echo trim($block->find('img', 0)->alt);                     // forecast
      echo " ";
      echo trim(str_replace("&deg;", "." , $block->find('span[class=cent]', 0)->plaintext));  // temp
      echo " -- ";
}
    
// clean up memory
$html->clear();
unset($html);

?>

Hope this gives you some ideas.

Andrew

PS The weather scraping script has now stopped working as the BBC changed their weather forecast pages. That’s the trouble with scraping - it’s very brittle.