XBEE Arduino LEDS

Im trying to use a magnetometer to send a heading via XBEES to another arduino that then relays that heading through the RX pin of an arduino UNO controlling 2 LEDS. I want the LED on pin 12 to come on if the heading is less than 45 and the led on pin 11 to come on if the heading is greater than 45. For some reason its not working and i cant for the life of my understand why. any help on getting the Serial.read() data to be usable in my if statements would be greatly appreciated.

int heading = 0;  // for incoming serial data
 
void setup() {
  Serial.begin(57600); // opens serial port, sets data rate to 9600 bps
  pinMode(12, OUTPUT);
  pinMode(11, OUTPUT);


}
 
void loop() {
  // send data only when you receive data:
  if (Serial.available()>0 ) {
    // read the incoming byte:
     heading = (int) Serial.read();
 
    if(heading > 45){
      digitalWrite(12, LOW);
         digitalWrite(11, HIGH);
    }else if(heading < 45){
      digitalWrite(12, HIGH);
     
    }    
    // say what you got:
   // Serial.print("Fio received: ");
    Serial.write(heading);  
   // Serial.write(10);    
  }
}

Explain more about what is not working. Note your code has a blind spot when the heading is exactly 45.
Serial read returns a single byte what are you inputting in the serial monitor? It will be an ASCII code you know.

i have two arduino fios. one for transmitting the information from the magnetometer and another one for recieving. i then have the recieving fio connected to my UNO on the RX pin. the code for both of those works and i can manage to get my headings to display in the serial monitor of the aruduino uno. The problem is i cant seem to utilize the data. ive tried to cast Serial.read() and an int but it still didnt help.

That code you posted will simply set pin 12 HIGH or pin 12 LOW, are you not seeing that? Connect an LED to pin 12 through a resistor and verify.

Not sure what pin 11 is doing, once set HIGH it stops HIGH.