Hi everyone!
I'm trying to send just a picture via LoRa. It's little small picture and It has small packets (about 10 packet with 100 byte size). Last part that stuck is ACK. When I'm trying to add packet number to my image packet, my packet randomly changes however.
So I wanna add a packet number front of my image packet. And add an ACK proccess to receiver side. When it gets and packet correctly, will read the packet number and will send it to transmitter side. Basically like this.
Modules: Arduino Uno x2, ESP32 CAM, RFM98W x2
Here's my transmitter Arduino Uno
while(packetSize == PACKET_SIZE) {
packetSize = PACKET_SIZE;
if((imageVector.Size() - numberOfSentBytes) < packetSize) {
packetSize = (imageVector.Size() - numberOfSentBytes);
}
char packetData[packetSize];
memset(packetData, 0, packetSize*sizeof(char));
for(int i = 0; i < packetSize; i++) {
packetData[i] = imageVector[numberOfSentBytes + i];
packetNumber++;
}
numberOfSentBytes += packetSize;
radio.transmit(packetData, packetSize, 0);
delay(500);
Here's my receiver Arduino Uno
char packetData[packetSize];
int state = radio.receive(packetData, packetSize);
if (state == ERR_NONE) {
Serial.write(packetData, packetSize);
}
Is there any wrong thing? And do you have any idea to do it easily? I'm open to any things. Thanks.