Hi, I have the Heltec Wireless Stick board as a receiver and the TTGO T-Beam board as a sender. The problem is reading the sender data in the receiver, for now it is a number but solving it I want to send temperature, GPS location and measure the maximum distance. I’m newbie at this so maybe i can’t send between two different boards
Sender code (TTGO T-Beam)
//Libraries for LoRa
#include <SPI.h>
#include <LoRa.h>
//define the pins used by the LoRa transceiver module
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
//packet counter
int counter = 0;
void setup() {
//initialize Serial Monitor
Serial.begin(115200);
Serial.println("LoRa sender");
//SPI LoRa pins
SPI.begin(SCK, MISO, MOSI, SS);
//setup LoRa transceiver module
LoRa.setPins(SS, RST, DIO0);
if (!LoRa.begin(BAND)) {
Serial.println("LoRa has failed");
while (1);
}
Serial.println("LoRa has started");
delay(2000);
}
void loop() {
Serial.print("Packet ");
Serial.println(counter);
LoRa.beginPacket();
LoRa.print(counter);
LoRa.endPacket();
counter++;
delay(2000);
}
Receiver code (Heltec Wireless Stick)
#include "heltec.h"
//433E6 for Asia
//866E6 for Europe
//915E6 for North America
#define BAND 915E6
String LoRaData;
void setup() {
Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
Heltec.display->drawString(0, 0, "LoRa receiver");
Serial.println("LoRa receiver");
Heltec.display->drawString(0, 12, "LoRa has started");
Serial.println("LoRa has started");
Heltec.display->display();
Heltec.display->clear();
delay(2000);
}
void loop() {
int packetSize = LoRa.parsePacket();
if (packetSize) {
Serial.print("Received packet '");
Heltec.display->drawString(0, 0, "Received packet ");
while (LoRa.available()) {
LoRaData = LoRa.readString();
Serial.println(LoRaData);
Heltec.display->drawString(5, 10, LoRaData);
}
int rssi = LoRa.packetRssi();
Serial.print("' with RSSI ");
Heltec.display->drawString(0, 20, "with RSSI ");
Serial.println(rssi);
Heltec.display->drawString(10, 20, String(rssi));
}
}