I am trying to combine the buf[] received into a char (strRec).
The Serial.print((char)buf[i]); prints the correct information received.
This is not a project so any assistance would be appreciated.
#include <VirtualWire.h>
/*
sent example = A001*, A002* etc
*/
void setup()
{
Serial.begin(115200); // Debugging only
Serial.println("Receiver setup");
// Initialise the IO and ISR
// vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(11); // Arduino pin (default 11)
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
}
void loop() {
char strRec;
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
digitalWrite(13, true); // Flash a light to show received good message
// Message with a good checksum received, dump it
for ( int i = 0; i < buflen; i++)
{
**strRec += ((char)buf[i]);**
Serial.print((char)buf[i]);
}
Serial.print(" received: "); Serial.print(strRec);
Serial.println();
digitalWrite(13, false);
delay(200);
}
}