I'm trying to send and receive some data from arduino to another arduino and I'm using arduino UNO and FS1000A / XY-MK-5V 433Mhz TX/RX Modules.
For transmitting I use the library VirtualWire and It works very well for this code:
#include <VirtualWire.h>
void setup()
{
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
}
void loop()
{
char msg[7] = {'h','e','l','l','o',' ','!'};
vw_send((uint8_t *)msg, 7);
vw_wait_tx(); // Wait until the whole message is gone
delay(1000);
}
I was wondering if I want to send some string or int data how I can do that.
I tried to use it for string data but I couldn't because the Input of function vw_send(...) is char and I couldn't use int or string.
finally I run this code:
#include <VirtualWire.h>
void setup()
{
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
}
void loop()
{
char msg[11]="Hello there";
vw_send((uint8_t *)msg, 11);
vw_wait_tx(); // Wait until the whole message is gone
delay(1000);
}
and I could send Hello there !, but I'm looking for the correct way for sending string and int.