Forum Replies Created
-
AuthorPosts
-
9 November 2021 at 19:10 in reply to: EByte LoRa e32 not working on esp32: sends a random number, the other reads #16252
Lo he probado todo y sigue sin salirme 🙁
9 November 2021 at 19:06 in reply to: EByte LoRa e32 not working on esp32: sends a random number, the other reads #16251Hola buenas!
Tengo un LoRa E32 900T20D y no consigo recibir la información de los mensajes.
Código emisor:
#include “Arduino.h”
#define E32_TTL_1W
#define FREQUENCY_868
#include “LoRa_E32.h”
#define AUX 21
#define M0 18
#define M1 19
LoRa_E32 e32ttl(&Serial2, AUX, M0, M1);// Variables globales
unsigned long interval = 15000;
unsigned long lastSendTime = 0;
byte msgCount = 0;
long randNumber;
void setup() {
//Inicio comunicacion serie con monitor
Serial.begin(9600);
delay(500);
e32ttl.begin();
//Configuro el nodo LoRa
nodeConfig();
}void loop() {
// Wait a few seconds between measurements.// print a random number from 10 to 19
randNumber = random(10, 20);
String trama = String(randNumber);
ResponseStatus rs = e32ttl.sendFixedMessage(0x0, 0x3, 0x10, trama);
Serial.println(“Sending ” + trama);
Serial.println( rs.getResponseDescription());
msgCount++;
delay(5000);
}void nodeConfig() {
ResponseStructContainer c;
c = e32ttl.getConfiguration();
Configuration configuration = *(Configuration*) c.data;
configuration.ADDH = 0x00;
configuration.ADDL = 0x1;
configuration.CHAN = 0x10;
configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.fec = FEC_1_ON;
configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
configuration.OPTION.transmissionPower = POWER_30;
configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250;
// Set configuration changed and set to not hold the configuration
ResponseStatus rs = e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
Serial.print(“Config: “);
Serial.println(rs.getResponseDescription());
}Código Receptor:
#include “Arduino.h”
//#define E32_TTL_1W
//#define FREQUENCY_915
#include “LoRa_E32.h”
#define FREQUENCY_868// Not needed Serial2 have already this pins
#define RX 16
#define TX 17#define AUX 18
#define M0 21
#define M1 19//HardwareSerial serial1(2);
//LoRa_E32 e32ttl1w(&serial1,RX,TX, 18, UART_BPS_RATE_9600,SERIAL_8N1);
LoRa_E32 e32ttl(&Serial2, AUX, M0, M1);
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);// Variables globales
unsigned long interval = 15000; // interval between sends
unsigned long lastSendTime = 0; // last send time
byte msgCount = 0; // count of outgoing messages
long randNumber;
void setup() {
//Inicio comunicacion serie con monitor
Serial.begin(9600);
delay(500);
// Startup all pins and UART
e32ttl.begin();
//Configuro el nodo LoRa
nodeConfig();
}
void loop() {
if (e32ttl.available() > 0){
Serial.println(“———-“);
ResponseContainer rc = e32ttl.receiveMessage();
String message = rc.data;
Serial.println(message);
}
delay(5000);
}
void nodeConfig(){ResponseStructContainer c;
c = e32ttl.getConfiguration();
Configuration configuration = *(Configuration*) c.data;configuration.ADDH = 0x0;
configuration.ADDL = 0x3;
configuration.CHAN = 0x10;configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.fec = FEC_1_ON;
configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
configuration.OPTION.transmissionPower = POWER_20;
configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250;
//printParameters(configuration);// Set configuration changed and set to not hold the configuration
ResponseStatus rs = e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
Serial.println(“Config: “);
Serial.print(rs.getResponseDescription());
} -
AuthorPosts