I'm new to radio modules and the RadioHead library, and I'm faced with the following problem.
In my project I use Wemos D1 R1 and the LORA module based on SX1276(868MHZ and 915MHz). When using the following sketch (it practically does not differ from the example from the library), an init failed error occurs and Wemos at a speed of 74880 baud issues a message
Code:
#include <SPI.h>
#include <RH_RF95.h>
RH_RF95 rf95; //As stated in the library, NS and DIO 0 are connected to pin 10 and 2.
void setup()
{
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
rf95.setFrequency(915.0);
Serial.begin(9600);
while (!Serial) ; // Wait for serial port to be available
if (!rf95.init())
Serial.println("init failed");
}
void loop()
{
Serial.println("Sending to rf95_server");
// Send a message to rf95_server
uint8_t data[] = "Hello World!";
rf95.send(data, sizeof(data));
rf95.waitPacketSent();
// Now wait for a reply
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.waitAvailableTimeout(3000))
{
if (rf95.recv(buf, &len))
{
Serial.print("got reply: ");
Serial.println((char*)buf);
}
else
{
Serial.println("recv failed");
}
}
else
{
Serial.println("No reply, is rf95_server running?");
}
delay(400);
}
Output Serial on 9600 baud:
�EO�H�4�l,@>l|ll�4b:
�.$ld�init failed
Sending to rf95_server
Output Serial on 74880 baud:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00043b50
~ld
rf cal sector: 1020
freq trace enable 0
rf[112] : 0�����������������������������������������������������������������������
Electrical connection diagram:
What is my mistake?
