Hello,
i have 2 arduino nano boards, one is connected to a stx882 v1.2, Data is pin D12
And one is connected to a srx882 v1.3 Data pin D11
i run a simple command to send "10" to the SRX but i do not get any value out of it.
How can i debug this?
Transmitter:
#include "VirtualWire.h"
#include "string.h"
const int transmit_pin = 12;
void setup()
{
vw_set_tx_pin(transmit_pin);
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
Serial.begin(9600); // Debugging only
}
char senddata[2] = {'1','0'};
void loop()
{
vw_send((byte *)senddata, strlen(senddata));
vw_wait_tx(); // Wait until the whole message is gone
Serial.print("send");
delay(10000);
}
Reciever:
#include <VirtualWire.h>
#include <Wire.h>
const int receive_pin = 11;
void setup() {
Serial.begin(9600); // Debugging only
Serial.println("setup");
vw_set_rx_pin(receive_pin);
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
}
void loop() {
/*RF ontvangen*/
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
int i;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
buf[buflen] = '\0';
// Message with a good checksum received, print it.
Serial.print("Got: ");
Serial.print(buflen);
Serial.print("Got: ");
for (i = 0; i < buflen; i++)
{
Serial.write(buf[i]);
}
}
Serial.println(buflen);
}