Bonjour,
Je souhaite faire envoyer un message entre deux objets en utilisant le protocole sans fil Lora 868Mhz.
J'ai pour cela connecter un module Grove Lora radio 868Mhz à un seeeduino nano. J'ai raccorder l'alimentation du module Lora sur le Nano et le Rx et Tx en croisant bien Rx et Tx sur le Nano.
J'ai installé la bibliothèque RH_RF95.h téléchargé sur le GitHub de SeeedStudio puis téléversé l'exemple rf95-client. J'ai mis à jour les numéros de pin pour la communication.
Voici l'exemple :
// rf95_client.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messageing client
// with the RH_RF95 class. RH_RF95 class does not provide for addressing or
// reliability, so you should only use RH_RF95 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example rf95_server
// Tested with Anarduino MiniWirelessLoRa
#include <RH_RF95.h>
#ifdef __AVR__
#include <SoftwareSerial.h>
SoftwareSerial SSerial(0, 1); // RX, TX
#define COMSerial SSerial
#define ShowSerial Serial
RH_RF95<SoftwareSerial> rf95(COMSerial);
#endif
#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
#define COMSerial Serial1
#define ShowSerial SerialUSB
RH_RF95<Uart> rf95(COMSerial);
#endif
#ifdef ARDUINO_ARCH_STM32F4
#define COMSerial Serial
#define ShowSerial SerialUSB
RH_RF95<HardwareSerial> rf95(COMSerial);
#endif
void setup() {
ShowSerial.begin(115200);
ShowSerial.println("RF95 client test.");
if (!rf95.init()) {
ShowSerial.println("init failed");
while (1);
}
// Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
// The default transmitter power is 13dBm, using PA_BOOST.
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm:
//rf95.setTxPower(13, false);
rf95.setFrequency(868.0);
}
void loop() {
ShowSerial.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)) {
// Should be a reply message for us now
if (rf95.recv(buf, &len)) {
ShowSerial.print("got reply: ");
ShowSerial.println((char*)buf);
} else {
ShowSerial.println("recv failed");
}
} else {
ShowSerial.println("No reply, is rf95_server running?");
}
delay(1000);
}
Dans le moniteur série j'ai le retour "RF95 client test." puis "init failed". J'ai essayé d'inverser Rx et Tx, mais ça ne marche pas.
Quelqu'un pourrait m'aider svp ?
Merci