Virtual Wire lib, RFlink and sending RFID readings

I am having an issue with what appears to be re-installing a Library in Arduino.
Its the Virtual Wire Library. Before re-installing it my sketches worked perfectly. And after they don't. After a lot of troubleshooting and fixing the hardware, I think this must be it. I re-installed the version of the Library I used before, but still no luck.

More specifically, I am using an RFlink and and an RFID reader to read tags and send their numbers wirelessly across the RFlink. What happens is that the two systems work separately but not together. So the RFID reader reads tags perfectly and the RFlink sends across correct different sets of data. But when I try to send different tag numbers across to the receiver, I only get tag number 1, even when the reader reads nine different tags.

Could it be a problem between the applet folder and the path to the reinstalled Library? I also dont understand how the .c .cpp and .cpp.o files in the applet might affect the path. Do I need to erase the applet folder all together so that the sketch re-builds a path to the Library? I tried erasing the applet folder, still no luck. I don't know how to make my sketch connect to the library without messing its path on the way.

Any clues????

Cheers,
Artemis

Which version of the Arduino IDE are you using? On what operating system?

Which version of the Virtual Wire Library did you install? From where?

But when I try to send different tag numbers across to the receiver, I only get tag number 1, even when the reader reads nine different tags.

This sounds more like a coding problem. If you scan tag #8, how does the code know anything about tag #1, which you haven't scanned? How can the code send data for a tag that hasn't been scanned?

I am using Arduino 018, Virtual Wire Library from this link: http://www.open.com.au/mikem/arduino/
VirtualWire-1.4 cos this was released at the time.
On MacOS X 10.4.11

you are right about the code. It only sends 1 because I initialize
int whichTag=1; in the beginning, so it doesnt go through the rest of the code at all.

But still dont know how to unblock the Virtual Wire path

But still dont know how to unblock the Virtual Wire path

Not quite sure what this means.

If you mean that you can't get the Arduino code to communicate using the VirtualWire functions, then we need to know what devices are connected to the Arduino, how they are connected, and what code is running on the Arduino.

Hi,
yes thats what I meant.
The devices I use are two Freeduinos ATMega328, one Parallax RFID reader connected to the one with an RFlink transmitter (here: http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=186)

and the second Freeduino is connected with the receiver. The transmitter runs on 8V for higher performance and the rest on 5V.

To mention. The RFID reads perfectly well without the Virtual Library stuff, and the transmitter transmits fine without the RFID reading. Thats why I think there is something going on with the Library. Do you think it is a path problem, since I reinstalled the Library (tried both the old and updated versions of the VW)

The code for the transmitter that used to work fine but now doesnt is this one:

TRANMITTER CODE:

#include <SoftwareSerial.h>
#include <VirtualWire.h>
#undef round

//-----------------------------------------------------------//FOR RF -> DH
int whichTag = 1;          //the variable saying which tag was read
#define ledPin 13

//-----------------------------------------------------------//for rfid
#define rxPin 3   //connect with SOUT / TX in RFID at 2400bps
#define txPin 2   //conenct with enable pin

SoftwareSerial RFID = SoftwareSerial(rxPin,txPin); 

byte  rfidval = 0; 

char code[10]; 
int bytesread = 0; 

char tag1[] = {
  '2', '3', '0', '0', '6', 'E', '7', '6', '6','4'}; 
char tag2[] = {
  '2', '3', '0', '0', '6', 'E', '5', 'D', '7','F'}; 
char tag3[] = {
  '2', '3', '0', '0', '6', 'F', '7', '7', '1','E'};


//-----------------------------------------------------------//setup
void setup() {

  Serial.begin(9600); //NECESSARY
  RFID.begin(2400);

  pinMode(ledPin, OUTPUT);  
  pinMode(txPin, OUTPUT);
  pinMode(rxPin, INPUT);  

  // RF LINK STUFF -> DH
  vw_set_tx_pin(9);                              
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000);       // Bits per sec

  digitalWrite(txPin, LOW);    // Activate the RFID reader 
}

void loop(){

  rfidval = RFID.read();

  //-----------------------------------------------------//  

  if(rfidval == 10)
  {   
    bytesread = 0;

    while(bytesread<10)
    {  
      rfidval = RFID.read(); 

      if((rfidval == 10)||(rfidval == 13))
      { 
        break;                       
      } 
      code[bytesread] = rfidval;                 
      bytesread++;                   
    } 


    //-----------------------------------------------------------//start to compare tags with with code
    if(bytesread == 10)
    {      // if 10 digit read is complete
      for(int i=0; i<10;i++){
        //Serial.print(code[i]);
        if (code[7]==tag1[7] && code[8]==tag1[8] && code[9]==tag1[9]) {        //   1
          flickrLED();
          whichTag = 1;
          Serial.println("1");
        }
        if (code[7]==tag2[7] && code[8]==tag2[8] && code[9]==tag2[9]) {        //   2
          flickrLED();
          whichTag = 2;
          Serial.println("2");
        }
        if (code[7]==tag3[7] && code[8]==tag3[8] && code[9]==tag3[9]) {        //   3
          flickrLED();
          whichTag = 3;
          Serial.println("3");
        }     
      }
    }
  }
  handleRF();
  
}

void flickrLED() {
  digitalWrite(ledPin, HIGH);   
  delay(20);
  digitalWrite(ledPin, LOW);
  delay(20);      
} 

void handleRF()
{
  if (whichTag == 1)  {
    const char *msg = "s21";
    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);
  }  
  else if (whichTag == 2) {
    const char *msg = "s22";
    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);
  }
  else if (whichTag == 3) {
    const char *msg = "s23";
    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);
  }

}

and the RECEIVER CODE:

#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_rx_pin(8);    //otherwise pin is by default 11
    vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
    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.
      
      
      for (i = 0; i < buflen; i++)
      {
          Serial.print(buf[i], BYTE);
         
      }
      Serial.println("");
        digitalWrite(13, false);
    }
}

What do think?...
Thanks,
A

The compiler is the only piece of software that cares where the library is located. If the compiler can find it, and it must be able to to be able to compile the code. The linker only cares about .o files that are located in the build directory, that are put there by the compiler. Once the linker has done it's job, and made the .hex file that gets loaded to the Arduinos, there is no link between the Arduino and the library on the PC.

So, no, it isn't a library install problem.

Either you are now using a different version of the Virtual Wire library, or there is some change to the sender or receiver code.

SoftwareSerial is obsolete. Try switching to NewSoftSerial.

What is printed in the Serial Monitor when a tag is scanned?