How to send temperature data from Processing to Arduino?

I'm building this weather station that uses a modified XML Yahoo Weather example on Processing. I have it setup so when a specific weather condition is met it send's a particular Byte to match it for example if it is sunny, send the byte 'a' and on the Arduino if it receives an 'a' it prints "sunny" to the screen.

This method seems to work ok, and it will display what weather condition it is outside, but how can I send temperature data over with the condition data at the same time?
For sending the data from processing, I tried this (or something along the lines of)

serial.write(temperature);

I have a feeling it's sending the temperature data to the Arduino, but how do I access this data and what code do I use on the Arduino to print the temperature data onto the LCD screen? I've only been using Arduino for 3 months, maybe I'm way over my head on this project.

(anywhere you see N/A F is where the temperature data is supposed to go)

Arduino Code:

int ledG = 13; //LED GREEN (Good Weather)
int ledY = 10; //LED YELLOW (Mild Weather, Rain, etc)
int ledR = 9; // LED RED (Severe Weather Alert)
//int temp = Serial.read, temperature;

//include library code:
#include<LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
lcd.begin(16,2); //Columns and rows of screen

pinMode(ledG, OUTPUT); //Setup LEDs
pinMode(ledY, OUTPUT);
pinMode(ledR, OUTPUT);

Serial.begin(9600);

}

void loop()
{

while(Serial.available())
{
char getData = Serial.read(); //Is there anything to read?
Serial.write(getData); // if yes, then read it

if(getData == 'a')
{

lcd.setCursor(0,0);
lcd.print("Today's Weather:");
lcd.setCursor(0,2);
lcd.print("Fair, N/A F");
digitalWrite(ledG, HIGH);
digitalWrite(ledY, LOW);
digitalWrite(ledR, LOW);

delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Wooster, OH:");
lcd.setCursor(0,2);
lcd.print("Fair, N/A F");
digitalWrite(ledG, HIGH);
digitalWrite(ledY, LOW);
digitalWrite(ledR, LOW);
delay(5000);
}

else if(getData == 'b')
{
digitalWrite(13,HIGH);

lcd.setCursor(0,0);
lcd.print("Today's Weather:");
lcd.setCursor(0,2);
lcd.print("Rain, N/A F");
digitalWrite(ledG, LOW);
digitalWrite(ledY, HIGH);
digitalWrite(ledR, LOW);
delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Wooster, OH:");
lcd.setCursor(0,2);
lcd.print("Rain, N/A F");
digitalWrite(ledG, LOW);
digitalWrite(ledY, HIGH);
digitalWrite(ledR, LOW);
delay(5000);

}
}
}

Processing:

/**

  • Loading XML Data
  • by Daniel Shiffman.
  • This example demonstrates how to use loadXML()
  • to retrieve data from an XML document via a URL
    */

PImage cf;
// We're going to store the temperature
int temperature = 0;
// We're going to store text about the weather
String weather = "";
//int fair = 'a';
// The zip code we'll check for
String zip = "44691";

PFont font;

import processing.serial.*;
Serial port;

void setup() {
size(600, 360);

font = createFont("Merriweather-Light.ttf", 28);
fill(#000000);
textFont(font);
println(Serial.list());
port = new Serial(this, Serial.list()[0], 9600); //Serial Communication

// The URL for the XML document
/*String url = "http://xml.weather.yahoo.com/forecastrss?p=" + zip;

// Load the XML document
XML xml = loadXML(url);

// Grab the element we want
XML forecast = xml.getChild("channel/item/yweather:condition");
*/
// Get the attributes we want
//temperature = forecast.getInt("temp");
//weather = forecast.getString("text");

cf= loadImage("clouds.jpg");
}
void draw()
{
// The URL for the XML document
String url = "http://xml.weather.yahoo.com/forecastrss?p=" + zip;

// Load the XML document
XML xml = loadXML(url);

// Grab the element we want
XML forecast = xml.getChild("channel/item/yweather:condition");
temperature = forecast.getInt("temp");
weather = forecast.getString("text");
weather = weather.toLowerCase();
image(cf, 0, 0, 600, 360);

// Display all the stuff we want to display
text("Wooster OH: ", width0.15, height0.33);
text("Current Temperature: " + temperature, width0.15, height0.5);
text("Forecast: " + weather, width0.15, height0.66);

port.write(temperature);

if ( weather.contains("fair"))
{
port.write('a');
println("Fair");
}

else if (weather.contains("rain"))
{
port.write('b');
println("Rain");
}

else if (weather.contains("cloud"))
{
port.write('c');
println("Cloudy");
}
else if (weather.contains("sun"))
{
port.write('d');
println("Sunny");
}
else if (weather.contains("clear"))
{
port.write('e');
println("Clear");
}
else if( weather.contains("storm"))
{
port.write('f');
println("T-Storms");
}
else
{
port.write('x');
println("No Data Avalaiable");
}

(Here is where I tried something, that seemed promising at first but did not give me any results.)

/* delay(4000);

port.write(temperature);

delay(4000);

port.write('w');

delay(40000);
*/
}

I've only been using Arduino for 3 months

When you have time to read the how to use the forum sticky about posting code correctly and you have modified that first post then I will look at it.

In the meantime someone else might.

If you send, from Processing, the temperature, as a string, the Arduino will get something like "78" (if it's a warm day in the US).

Where, exactly, do you deal with that, in the Arduino code? The ONLY thing you care about is 'a' or 'b'.

You need to have the Processing app send something like "a!", "b!", "t78!". Then, you read AND STORE the data in an array, until the ! arrives. When the ! arrives, you can use the data ('a', 'b', or "t78").

It isn't rocket science to change "t78" to " 78", and call atoi() to get 78 or just use the string.

PaulS:
It isn't rocket science

It may not be for you, but for someone starting out on Arduino, it is. Sorry that I may not have the same "intellect" as you, but coming here just made me feel even more helpless. So thanks. Thank you for giving me your time to help me, but also thank you for giving me a bad first impression of the Arduino forums and not making me feel welcome here. I now know to look somewhere else to get help and maybe just not get into Arduino altogether. Everyone had to start somewhere, including you I hope one day you realize that. I'll just take my problems somewhere else.

Everyone had to start somewhere,

Yes and any sensible person would read the how to use the forum sticky post that is at the start of every section and is right next to the place you clicked to start the thread.

Then when this was pointed out, again you might expect a sensible person to comply with what is asked, in exchange for some free advice, rather than throw his toys out of the pram.

I'll just take my problems somewhere else.

Yes maybe you will find a forum that tolerates people who are too lazy or arrogant to even look at the basics of how to behave. However, I doubt it.
Good luck.

It may not be for you, but for someone starting out on Arduino, it is.

Really?

char stuff[] = "t87";
char cmd;

cmd = stuff[0]; // cmd is now t;
stuff[0] = ' '; // stuff is now " 87"