RF 433MHz Transmitter and Receiver on same Arduino

Hi!

Thank you for your answers. I "broke stone" and my mind :slight_smile: to find the best code to solve this situation and I solved my problem. The solution is:

1 - The code to receive and send don't work at same time (answer to PaulS) so if Arduino 1 send and RF message it isn't able to receive their own message;
2- I develloped two different functions: one to receive and another to send and it is on void loop().
3- I felt one problem: when Arduino 1 try to receive one RF message it stopped on this line and wait for a long time so I put a timeout to garantee that Arduino 1 continues working without delays.

Here is my code:

void send (char *message)
{
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone
}

void receiveRF()
{

vw_rx_start(); //start receive
vw_wait_rx_max(100); //timeout
uint8_t message[VW_MAX_MESSAGE_LEN];
uint8_t msgLength = VW_MAX_MESSAGE_LEN;
if (vw_get_message(message, &messageLength)) // Non-blocking
{
for (int i = 0; i < messageLength; i++)
{
Serial.write(message*);*

  • }*
  • Serial.println();*
  • }*
  • vw_rx_stop(); //stop receive*
    }
    With this information I hope to help everybody that have this needs.