[Help] RSS feeds - Getting the various information available from ONE RSS feed

Hello! First off, I'm trying to create a project that will use LEDs to display the service status' of various London underground lines. To do this I have physical switches corresponding to each line, with their outputs sent from Arduino to Processing, with Processing drawing in the RSS feed. From this feed I need to select the underground line that corresponds with the original switch chosen, and then have the service status sent back to Arduino, in order for the LEDs to display the correct data.

So far, I have Arduino and Processing talking to each other, and I've tested a Yahoo RSS feed in Processing, which brings in various news headlines, under the xml tag 'title'.

First problem - when changing the RSS feed over to 'http://cloud.tfl.gov.uk/TrackerNet/LineStatus', and altering the tags, I get no data coming through at all? No error messages at all. Any ideas?

Secondly, each tube line; Bakerloo, Northern, Piccadilly etc are all contained within the same RSS feed, so my main question, is how could I have Processing differentiate between the service statuses for the different lines?

Any ideas? Any help would be greatly appreciated.

Copy of the Processing code that isn't working with the Transport For London RSS feed:

    import processing.serial.*;

import simpleML.*;
XMLRequest xmlRequest;

int val = 0; 
Serial port; 

void setup() {
  size(200,200);
    xmlRequest = new XMLRequest(this,"http://cloud.tfl.gov.uk/TrackerNet/LineStatus");
  xmlRequest.makeRequest();  
  port = new Serial(this, Serial.list()[0], 9600); 
}

void draw() {
 background(val); 
   if (mousePressed == true) 
  {                           
   port.write('1');         
   println("1");   
  } 
}


void serialEvent(Serial port) {
  val = port.read();
   println(val);
}

void netEvent(XMLRequest ml) {

  String[] Tubeline = ml.getElementArray("LineStatus");


for (int i = 0; i < Tubeline.length; i++) 
    println(Tubeline [i]);

}
Tagged:

Answers

  • I don't know the simpleML library, you should check its doc, or use the built-in support of XML by Processing.

  • I must add that I am mostly new to coding - I believe my first real problem is the format of the RSS feed. I'm used to seeing things laid out with very obvious and tags - The Transport For London feed is different. Forgetting the simpleML library, how would you go about breaking down the RSS feed information in order to bring it into Processing?

Sign In or Register to comment.