wireless communications with rf 433Mhz
got set of: 433mhz rf wireless transmitter + receivers. did searching , found these tow sketches. work. instead of printing "hello" on screen of computer connected receiver, seems sending string of numbers like: 48 65 6c 6c 6f. need able send short text strings. idea whats up? i'm using 2 arduino uno's.
transmitter code:
code: [select]
// transmitter code
#include <virtualwire.h>
//grove - 315(433) rf link kit demo v1.0
//by :http://www.seeedstudio.com/
//connect sent module d2 use
#include <virtualwire.h>
int rf_tx_pin = 12;
void setup()
{
vw_set_tx_pin(rf_tx_pin); // setup transmit pin
vw_setup(9600); // 2000 transmission speed in bits per second.
}
void loop()
{
const char *msg = "hello";
vw_send((uint8_t *)msg, strlen(msg)); // send 'hello' every 400ms.
delay(400);
}
the receiver code:
code: [select]
// recever//grove - 315(433) rf link kit demo v1.0
//by :http://www.seeedstudio.com/
//connect receive module d2 use ..
#include <virtualwire.h>
int rf_rx_pin = 7;
void setup()
{
serial.begin(9600);
serial.println("setup");
vw_set_rx_pin(rf_rx_pin); // setup receive pin.
vw_setup(2000); // transmission speed in bits per second.
vw_rx_start(); // start pll receiver.
}
void loop()
{
uint8_t buf[vw_max_message_len];
uint8_t buflen = vw_max_message_len;
if(vw_get_message(buf, &buflen)) // non-blocking i/o
{
int i;
// message checksum received, dump hex
serial.print("got: ");
for(i = 0; < buflen; ++i)
{
serial.print(buf[i], hex);
serial.print(" ");
//serial.print(buf[i]);
}
serial.println("");
}
}
Arduino Forum > Using Arduino > Programming Questions > wireless communications with rf 433Mhz
arduino
Comments
Post a Comment