bridge and virtualwire

It seems that bridge.h and virtualwire.h are not compatibles.

At least is what I understand from the errors:

src\Bridge.cpp.o: In function crc16_update(unsigned int, unsigned char)': C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:50: multiple definition of crc16_update(unsigned int, unsigned char)'
VirtualWire\VirtualWire.cpp.o:C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:50: first defined here
src\Bridge.cpp.o: In function crc_xmodem_update(unsigned int, unsigned char)': C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:66: multiple definition of crc_xmodem_update(unsigned int, unsigned char)'
VirtualWire\VirtualWire.cpp.o:C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:66: first defined here
src\Bridge.cpp.o: In function _crc_ccitt_update': C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:79: multiple definition of _crc_ccitt_update(unsigned int, unsigned char)'
VirtualWire\VirtualWire.cpp.o:C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:79: first defined here
src\Bridge.cpp.o: In function _crc_ibutton_update(unsigned char, unsigned char)': C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:90: multiple definition of _crc_ibutton_update(unsigned char, unsigned char)'
VirtualWire\VirtualWire.cpp.o:C:\Users\Paco\Documents\Arduino\libraries\VirtualWire/util/crc16.h:90: first defined here

Am I right. Cannot use virtualwire and bridge at the same time?

Thanks in advance

I'm facing similar problems. I need both Bridge and VirtualWire. Did you find any solution to this?

Finally I communicate Yun with a Nano, and Nano makes use of virtualwire.

Even communicating Yun with Nano was difficult. Fist, you cannot use TX, RX pins.

Second, I had problems with using other pins for serial communication... I do not remember the name of the library now...newsoft?... but it did not work for me.

So I decided to communicate Yun and Nano in the following way, using wires:

for example,

  • pin 4 is for triggering (HIGH means that a message is sent to the Nano). When Nano reads pin 4 as HIGH, it knows a message is ready.
  • pins 5,6 and 7 send the message. For example HIGH, HIGH, LOW. With 3 pins you have 2^3 possible messages.

So in this example you need 4 wires to communicate Yun and Nano.

This is the pseudo code for Yun

Yun, To send a message:
Pin 4 HIGH
Pin 5 HIGH, pin 6 HIGH, pin 7 LOW
delay(100)
pin4 LOW

pseudocode for Nano
loop()
{
if pin4 == HIGH read_message()
delay(50)
}

void read_message()
if pin5 = HIGH and pin6 = HIGH and pin7 = LOW do something (use virtualwire)
delay(80)

There is an issue because VirtualWire include a copy of file util/crc16.h (it's included on the Arduino beta enviroment with avr-libc).
You can fix it by removing your libraries/VirtualWire/util/crc16.h file
Once you remove it, your code will compile :slight_smile:

Great suggestion! It fixed my problem. Thanks for sharing.

@jessemonroy650

What exactly do we have to write in the Sketch ?

Kind regards
Alain

Alain:
@jessemonroy650

What exactly do we have to write in the Sketch ?

Kind regards
Alain

I don't recall writing this.
I am deleting the answer.

Jesse

Hola
también me he topado con ese problema, al utilizar arduino yun y el modulo de radiofrecuencia.
la solucion esta en editar los archivos de la librería VirtualWire.

En la carpeta de la librería VirtualWire editas el archivo VirtualWire.cpp en la parte que dice:

#include <util/crc16.h>

solo cambias el nombre del archivo que esta en la carpeta util dentro de la librería.
Por ejomplo yo lo hice así.

#include <util/crc162.h>

y el nombre del archivo que esta en la carpeta util crc16.h lo modifique a crc162.h

con esto debe esta funcionando la libreria sin conflictos con la Bridge.