virtual wire

guys could u help me???
im having a problem with virtual wire.!!
this is the code the first time i used it the led was lighting up constant when i press the button on the transmitter but now after a few months the led is blinking instead of lighting up constant (this is the receiver code)

#include <SoftwareServo.h>
#include <VirtualWire.h>

SoftwareServo servo1;


void setup()
{
  Serial.begin(9600);	// Debugging only
    Serial.println("setup");
  servo1.attach(9);
 
  vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);	 // Bits per sec
    vw_set_rx_pin(2);
    vw_rx_start();       // Start the receiver PLL running

pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(13, OUTPUT);
pinMode(1, OUTPUT);

   

  }

void loop()
{
  digitalWrite(3, LOW);
   digitalWrite(4, LOW);
   digitalWrite(5, LOW);
   digitalWrite(1, HIGH);
  servo1.write(71);
  SoftwareServo::refresh();

  
  
  
 uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
	int i;

        digitalWrite(13, true); // Flash a light to show received good message
	// Message with a good checksum received, dump it.
	Serial.print("Got: ");
	
	for (i = 0; i < buflen; i++)
	{
	    Serial.print(buf[i]);
        if(buf[i] == '1'){digitalWrite(3, HIGH);}//fwd
        if(buf[i] == '2'){digitalWrite(4, HIGH);}//bck
        if(buf[i] == '5'){digitalWrite(5, HIGH);}//lit
        
        if(buf[i] == '3')//lft
 {
  servo1.write(0);
 
    SoftwareServo::refresh();
  } 

if(buf[i] == '4')//rht
 {
   servo1.write(150);
 
    SoftwareServo::refresh();
  } 
  Serial.println("");
   digitalWrite(13, false);
   SoftwareServo::refresh();
   
}
    }
}

i remodeled this code from sparkfuns example code!!!
this is the transmitter code(which is working properly)

//transmitter

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600);	  // Debugging only
    Serial.println("setup");

    // Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);	 // Bits per sec
        vw_set_tx_pin(3); 
        
        pinMode(7, INPUT);
        pinMode(8, INPUT);
        pinMode(9, INPUT);
        pinMode(10, INPUT);
        pinMode(11, INPUT);
        pinMode(12, OUTPUT);

digitalWrite(7, HIGH);//fwr
digitalWrite(8, HIGH);//bkwr
digitalWrite(9, HIGH);//lft
digitalWrite(10, HIGH);//rht
digitalWrite(11, HIGH);//lit
digitalWrite(12, HIGH);//pwr

}

void loop()
{
  char *msg;
  
  if(digitalRead(7) == LOW){
    char *msg = "1";
      digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);}
  if(digitalRead(8) == LOW){
    char *msg = "2";
      digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);}
  if(digitalRead(9) == LOW){
    char *msg = "3";
      digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);}
  if(digitalRead(10) == LOW){
    char *msg = "4";
      digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);}
  if(digitalRead(11) == LOW){
    char *msg = "5";
      digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);}
  
  }

pls help!

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

this is the code the first time i used it the led was lighting up constant when i press the button on the transmitter but now after a few months the led is blinking instead of lighting up constant

Would that be the LED on pin 3, 4, 5, 13, or 1?

Why are you diddling with pin 1 AND using Serial at the same time?

What are you doing on the sender? What do your Serial.print()s show you?

How are the LEDs connected? Are there resistors, too?

How are the Arduinos powered? Via USB? How is the servo powered?

Nowhere near enough detail to help you.

PS. Before posting code again, use Tools + Auto Format. That code is a mess. Also, use the # icon when posting code, so the moderators don't have to, making one block of code where there should be two.

Yes, which LED(s)?
It would seem the Tx/Rx LED would only be on continuously if you pressing a button continuously.

hey guys now i fixed half the problem by changing the pins for the pwr to the rx module now the led is flickering (both tx and pin 11)

Being miswired always tends to complicate things :wink:

Are you using RF module with PTT pins?
If not, take this line out of both codes

vw_set_ptt_inverted(true); // Required for DR3100