Hi!
I'm using virtualwire library to conect 433Mhz RF with arduino.
Here is the deal, I send the messange in ASCII and get it as DEC,
How I can receive text data on ? or convert this dec to ascii?
Thanks!!
TX
#include <VirtualWire.h>
void setup()
{
Serial.begin(9600);
Serial.println("setup");
vw_setup(2000);
}
byte count =1;
void loop()
{
char msg[4] = {'o','i',count,'#'};
msg[3] = count;
digitalWrite(13, true);
vw_send((uint8_t *)msg,3);
vw_wait_tx();
digitalWrite(13, false);
delay(200);
count++;
if(count > 10)
count=0;
}
RX
#include <VirtualWire.h>
void setup()
{
Serial.begin(9600);
Serial.println("setup");
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 i;
digitalWrite(13, true);
Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
Serial.print(buf[i]);
Serial.print(" ");
}
Serial.println("");
digitalWrite(13, false);
}
}
and over serial monitor I get:
Got: 111 105 0
Got: 111 105 1
Got: 111 105 2
Got: 111 105 3
Got: 111 105 4
Got: 111 105 5
Got: 111 105 6
Got: 111 105 7
Got: 111 105 8
Got: 111 105 9
Got: 111 105 10
and my desired RX is
Got: o i 0
Got: o i 1
Got: o i 2
...