Sending numbers using 433MHz transmiter + receiver (FS1000A)

Hi arduino community, I'm new here and I'm facing some issues.
I have been reading a ton of tutorials but none of them had the solution for my question.

I would like to send a variable (numbers) throught the transmiter to the receiver, the problem is I can't find any tutorial that uses variables instead of text. I have been reading about converting int to char, but even that I can't do it.

I own an arduino Mega 2560 and an arduino uno.

Thanks in advance for those who are going to help me :slight_smile:

First get one of the tutorials (one that sends text) to work with your setup.

Then go through the code line by line until you understand the purpose of each step.

If you run into difficulties, post the code that actually works (using the # button to make it readable on the forum), explain what you tried that didn't work, and ask us how to fix it.

Actually while I was wating for an answer I keeped looking for a way to do it.

And I suceeded !!!

It sends a variable from 0 to 300 and goes back to 0, since I can now reach 65000 with my code I'm now able to use my sensors and send values over the air , it works exactly like I wanted it to be :slight_smile:
Transmiter part :

#include <VirtualWire.h>
  unsigned int a =0;
void setup()
{
    Serial.begin(9600);	  
    vw_set_ptt_inverted(true);
    vw_setup(2000);
    vw_set_tx_pin(12);	
}

void loop()
{
    vw_send((uint8_t *)&a, sizeof(a));
    vw_wait_tx(); 
    a++; 
    if (a> 300) a=0;
    delay(200);
}

receiver part :

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600);	


    // Initialise the IO and ISR
    vw_set_ptt_inverted(true); 
    vw_setup(2000);	

    vw_rx_start();       
}

void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) 
    {
      int a=0;
       
a=((int)(buf[1])<<8) |(buf[0]) ;
//Serial.print(a);

if (a> 260 )
{
Serial.print("H : superieur seuil");

}
else {
  Serial.print("L : inferieur seuil");
}

    }
}

Tell me if I can improve it, thank you for answering mate, have a nice day !!!