Hi, i have LoRa E32 433T30D module and i want to transfer data which 128byte. But this module can receive 58byte max. I want to use buffer but i could not figure it out how to use. Do you know how can i do that. Do you have example codes.
Hi esadcal,
I don’t have a code ready for you.
You need to create a structure with a progressive to recompose messages to the server.
The code depends on the kind of data to transfer.
If you post your possible solution, we will try to optimize it and help you.
Bye Renzo
Here is my ender code that I have tried to send the struct in chunks of 58 bytes. But I could not. My main problem is I did not understand how to use buffer or an algorithm like that.
#define E32_TTL_1W // E32 30d modülleri için bunu aktif et
#include "LoRa_E32.h"
#include <SoftwareSerial.h>
#include "Wire.h";
#include "Adafruit_BMP085.h"; //Basınç Sensörü Kütüphanesi
Adafruit_BMP085 mySensor;
#define BUFFER_SIZE 256
char buffer[BUFFER_SIZE];
int bufferIndex = 0;
int chunkSize = 58;
SoftwareSerial mySerial(10, 11);
LoRa_E32 FixajSS(&mySerial);
#define M0 7
#define M1 6
//PARAMETRE AYARLARI
#define Adres 1 //0--65000 arası bir değer girebilirsiniz. Diğer Modüllerden FARKLI olmalı
#define Kanal 20 //Frekans değeri Diğer Modüllerle AYNI olmalı.
//E32 için 0--31 arasında bir sayı giriniz.
//E32 433 için Frekans = 410 + kanal değeri
int sayac=0;
#define GonderilecekAdres 2 //Mesajın gönderileceği LoRa nın adresi
struct Signal {
char zaman[15]="11.12,24.01.23";
byte enlem[7];
byte boylam[7];
byte s[5];
byte b[7];
byte counter[4];
byte y[6];
byte b2[6];
byte hata[5];
} data;
void setup() {
pinMode(M0, OUTPUT);
pinMode(M1, OUTPUT);
Serial.begin(9600);
FixajSS.begin();
mySensor.begin();
digitalWrite(M0, LOW);
digitalWrite(M1, LOW);
delay(500);
Serial.println("başlıyoruz..");
}
void loop() {
*(float*)(data.enlem) = 37.1993;
*(float*)(data.boylam)= 45.4242;
*(float*)(data.s)=25.32;//mySensor.readTemperature();
*(float*)(data.b)=1023.45; //mySensor.readPressure();
*(float*)(data.b2)=101.42;
*(int*)(data.counter)=sayac;
*(float*)(data.y)=450.12;
//*(int*)(data.hata)=10100;
int dataSize = sizeof(Signal);
int offset = 0;
while (offset < dataSize)
{
int bytesToSend = min(chunkSize, dataSize - offset);
ResponseStatus rs = FixajSS.sendFixedMessage(highByte(GonderilecekAdres), lowByte(GonderilecekAdres), Kanal, (byte*)(&data) + offset, bytesToSend);
offset += bytesToSend;
delay(1000);
}
sayac++;
delay(500);
}
Maintaining a repository (or site or forum) is a lot like tending to a garden - it requires constant care and attention to keep it thriving. If you're a skilled gardener (or coder!) and want to help keep our repository blooming, we'd love to have you on board! We're also looking for talented writers and forum moderators to help us grow our community. Interested in joining our team? Don't hesitate to reach out and let us know how you can contribute!
Are you a fan of electronics or programming? Share your knowledge with others, write a simple tutorial or how to make a great project Contact me: share_your_ideas@mischianti.org
The content displayed on this website is protected under a CC BY-NC-ND license. Visitors are prohibited from using, redistributing, or altering any content from this website for commercial purposes, including generating revenue through advertising. Any unauthorized use is a violation of the license terms and legal action may be taken against individuals or entities found to be in violation.
You must also provide the link to the source.