REMOVAL OF GARBAGE VALUES

hello we are doing a project using arduino...we are doing IR communication in it...on the transmitter side we are sending a value 25...and on the receiver side we are getting 25 along with some garbage values as 255,254,158 etc..so how can we remove these garbage values? does, using of special characters like "$" will help us to remove garbage values, by sending "$25" ?and we are sending values as bytes....

this is our code
//transmitter code//

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int num1;
//dirt cheap wireless TX
//generates 38kHz carrier wave on pin 9 and 10
//sends data via TX every 500ms

//void transmitter(void);
void receiver(void);
void setup()
{lcd.begin(16, 2);
// Print a message to the LCD.
//lcd.print("100");
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);

// Clear Timer on Compare Match (CTC) Mode
bitWrite(TCCR1A, WGM10, 0);
bitWrite(TCCR1A, WGM11, 0);
bitWrite(TCCR1B, WGM12, 1);
bitWrite(TCCR1B, WGM13, 0);

// Toggle OC1A and OC1B on Compare Match.
bitWrite(TCCR1A, COM1A0, 1);
bitWrite(TCCR1A, COM1A1, 0);
bitWrite(TCCR1A, COM1B0, 1);
bitWrite(TCCR1A, COM1B1, 0);

// No prescaling
bitWrite(TCCR1B, CS10, 1);
bitWrite(TCCR1B, CS11, 0);
bitWrite(TCCR1B, CS12, 0);

OCR1A = 210;
OCR1B = 210;

Serial.begin(2400);

}
void loop()
{
//lcd.print("550");

//for(int num1 = 11; num1 < 16; num1++){
num1=11;
lcd.setCursor(8,1);
lcd.print(num1);
Serial.print(num1,BYTE);

//Serial.println("55");
//Serial.println("hello world");
//Serial.println("testing testing testing");
delay(500);
}
}

//receiver code//
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte num1;// The higher the number, the slower the timing.
void module2(void);
void setup()
{lcd.begin(16, 2);
Serial.begin(2400);
pinMode(13, OUTPUT);
}

void loop()
{
// if incoming serial
// delay(200);
if (Serial.available())
module2();
else
//module1();
digitalWrite(13, LOW);
}

void module2() {
if (Serial.available()) {
num1=Serial.read();
if((num1)==11)
{
digitalWrite(13, HIGH);
lcd.setCursor(8,1);
lcd.print(int(num1));
delay(100);
}
else {
digitalWrite(13, LOW);
}
}
}

OK, very good. Now please modify your post, select your code and then hit the "#" button to it looks like code.

ASRPABO:
...on the transmitter side we are sending a value 25...

I don't see anywhere in your code where you are sending 25.

sir we dont get u...we selected the code and hit # but nothing happened...what to do next

this is our code
//transmitter code//

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int num1;
//dirt cheap wireless TX
//generates 38kHz carrier wave on pin 9 and 10
//sends data via TX every 500ms

//void transmitter(void);
void receiver(void);
void setup()
{lcd.begin(16, 2);
  // Print a message to the LCD.
  //lcd.print("100");
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

  // Clear Timer on Compare Match (CTC) Mode
  bitWrite(TCCR1A, WGM10, 0);
  bitWrite(TCCR1A, WGM11, 0);
  bitWrite(TCCR1B, WGM12, 1);
  bitWrite(TCCR1B, WGM13, 0);

  // Toggle OC1A and OC1B on Compare Match.
  bitWrite(TCCR1A, COM1A0, 1);
  bitWrite(TCCR1A, COM1A1, 0);
  bitWrite(TCCR1A, COM1B0, 1);
  bitWrite(TCCR1A, COM1B1, 0);

  // No prescaling
  bitWrite(TCCR1B, CS10, 1);
  bitWrite(TCCR1B, CS11, 0);
  bitWrite(TCCR1B, CS12, 0);

  OCR1A = 210;
  OCR1B = 210;

  Serial.begin(2400);
   
}
void loop()
{
  
 num1=25;
 lcd.setCursor(8,1);
 lcd.print(num1);
Serial.print(num1,BYTE);
  delay(500);
}  
}

//receiver code//
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte num1;// The higher the number, the slower the timing.
void module2(void);
void setup()
{lcd.begin(16, 2);
Serial.begin(2400);
  pinMode(13, OUTPUT);
}

void loop()
{
  // if incoming serial
 // delay(200);
  if (Serial.available()) 
   module2();
  else
   //module1();
   digitalWrite(13, LOW);
}

void module2() {
if (Serial.available()) {
  num1=Serial.read();
  if((num1)==25)
  {
digitalWrite(13, HIGH);
   lcd.setCursor(8,1);
   lcd.print(int(num1));
 delay(100);
} 
 else {
    digitalWrite(13, LOW);
  }
}
}

sir we got... and by 25 we meant just a value it can be any value 25,11 or snything our problem is that we a geting garbage values along with it

How do you know you got garbage? Your code here:

void module2() {
  if (Serial.available()) {
    num1=Serial.read();
    if((num1)==25)
    {
      digitalWrite(13, HIGH);
      lcd.setCursor(8,1);
      lcd.print(int(num1));
      delay(100);
    } 
    else {
      digitalWrite(13, LOW);
    }
  }
}

... only displays something if that something is 25.

I'm not familiar with this "dirt cheap" IR stuff, but I Googled a bit and found a post here:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1235097384/15

Could be a hardware problem.

we have connected an lcd display to display what we are sending and receiving.

Yes, I can see that. But the code you gave only displays anything if the thing you receive is 25. So where does this other garbage appear? Or haven't you posted the code you actually use?

thankyou sir we will try with this new code

sir we were first trying by sending just one value..thats y we gave 25...we get the output as

output:255 etc