Virtual Wire library conflict with Wavehc library

Just including these two libraries within the same sketch generates an error when trying to compile, which looks like this:

VirtualWire\VirtualWire.cpp.o: In function __vector_11': C:\arduino-1.0\libraries\VirtualWire/VirtualWire.cpp:416: multiple definition of__vector_11' WaveHC\WaveHC.cpp.o:C:\arduino-1.0\libraries\WaveHC/WaveHC.cpp:41: first defined here

Is there a way to get these two libraries to work with each other. Or do I even need the Virtual Wire library at all?

Thanks for any and all help.

Could you post your library versions and maybe links to download them and which version of the Arduino software you use. I tried compiling a sketch but got another error.

Virtual Wire Library (version 1.5) :

WaveHC Library (version 20110919):


What I had to do to get the libraries compile:

  • edit VirtualWire.h includes: replace wiring.h with arduino.h
  • edit VirtualWire.cpp: comment out WProgram.h include

I searched the web and found version 1.9 ( which compiles with Arduino 1.0. WaveHC compiles without modification.

Both use Timer1 interrupts - the compilation error you get tells just this.

What can be done? I have read there are two of those 8 bit timers and if I remember correctly they are only used for PWM output. So I would play with the VirtualWire library to get it running on the other timer and then you can add WaveHQ without the compiling trouble - this is what I achieved already, but I do not have any hardware to test the functionality of VirtualWire.

The following alterations could get you a working VirtualWire on Timer2, modifications on version 1.9 First is the function at line 253 of VirtualWire.cpp where I changed everything to Timer2 (hope you do not have an atmega168, no idea what the TIMSK1 anomaly here is)

// Speed is in bits per sec RF rate
void vw_setup(uint16_t speed)
    // Calculate the OCR2A overflow count based on the required bit speed
    // and CPU clock rate
    uint16_t ocr2a = (F_CPU / 8UL) / speed;

#ifndef TEST
    // Set up timer2 for a tick every 62.50 microseconds 
    // for 2000 bits per sec
    TCCR2A = 0;
    TCCR2B = _BV(WGM12) | _BV(CS10);
    // Caution: special procedures for setting 16 bit regs
    OCR2A = ocr2a;
    // Enable interrupt
#ifdef TIMSK1
    // atmega168
    TIMSK1 |= _BV(OCIE2A);
    // others
    TIMSK |= _BV(OCIE2A);


    // Set up digital IO pins
    pinMode(vw_tx_pin, OUTPUT);
    pinMode(vw_rx_pin, INPUT);
    pinMode(vw_ptt_pin, OUTPUT);
    digitalWrite(vw_ptt_pin, vw_ptt_inverted);

Second change is at line 416


the line with the compile error. Now the ISR for Timer2 is used.

I have no idea if this will work or if it is even good to take Timer2 for this purpose. Anyone with more experience here to look at this?