Processing + Arduino Question

Hi all!
I’m pulling data from skyscanner into Processing, checking the flights prices and if there are flights under certain money I want to make Arduino do something. Everything is fine, except one “little” detail : the void draw function doesn’t get the value of my integers (the flight prices).
I guess this is quite stupid problem, but I don’t really know how to solve it.
I will appreciate any help !
This is the code:

JSONObject json;
int price1;
int price2;

import processing.serial.;
import cc.arduino.
;

Arduino arduino;
int ledPin = 13;

void setup() {
println(Arduino.list());

arduino = new Arduino(this, Arduino.list()[8], 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);

json = loadJSONObject(“http://www.skyscanner.net/db.ashx?m=b&fp=LHR&tp=SOFI&dd=20131208&ucy=UK&lid=en&ccy=GBP&wp=true&rd=20131217&qt=false”);

JSONArray values = json.getJSONArray(“rs”); // get the first array
JSONArray values2 = json.getJSONArray(“ds”); // get the second array

for (int i = 0; i < values.size(); i++) {

JSONObject rs = values.getJSONObject(i);
JSONObject ds = values2.getJSONObject(i);
price1 = rs.getInt(“p”);
price2 = ds.getInt(“p”);

if (price1 < 100) { //check if the price is less than £100 and print it out if so
print(price1 + “,” );
}

if (price2 < 100) { //check if the price is less than £100 and print it out if so
print(price2 + “,” );
}
}

void draw()
{
if (price1 < 100) { // check if the price is less than £100 and make Arduino to blink if so
arduino.digitalWrite(ledPin, Arduino.HIGH);
delay(100);
arduino.digitalWrite(ledPin, Arduino.LOW);
delay(1000);
}

if (price2 < 100) { // check if the price is less than £100 and make Arduino to blink if so
arduino.digitalWrite(ledPin, Arduino.HIGH);
delay(100);
arduino.digitalWrite(ledPin, Arduino.LOW);
delay(1000);
}

}

Code tags.

Read this before posting a programming question

How to use this forum

Everything is fine, except one "little" detail : the void draw function doesn't get the value of my integers (the flight prices).

The array of prices is local to setup. Only the last entry in each list is stored in global variables. There appear to be 5 entries in the ds section. The last 3 do not have prices. So, you get nothing when you call getInt() for the last entry in the list ds.