7.5.09

even more little big win


//woooooorks.

import simpleML.*;


XMLRequest xmlRequest;

int startTime; //create timer
int counter = 0;


void setup() {
size(200,200);
//create and start up request
xmlRequest = new XMLRequest(this,"http://weather.yahooapis.com/forecastrss?p=UKXX0078&u=c");
xmlRequest.makeRequest();
startTime = millis();//more timer stuff
}

void draw() {
background(0);

//every 5 seconds, make new request
int now = millis();
if (now - startTime > 5000) {
xmlRequest.makeRequest();
println("fio is epic");
startTime = now;
}
}

//when request is complete
void netEvent(XMLRequest ml) {

String temp = ml.getElementAttributeText("yweather:condition", "temp");


String weather = ml.getElementAttributeText("yweather:condition","text");


if (weather.equals("Partly Cloudy")) {
println("Partly Cloudy");

}


}


It tells me that I'm epic, and that the weather in Leeds is Partly Cloudy.

No comments: