/*
This is a simple example show the Heltec.LoRa sended data in OLED.
The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED's reset pin, the low-level signal at least 5ms.
OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA -- GPIO4
OLED_SCL -- GPIO15
OLED_RST -- GPIO16
by Aaron.Lee from HelTec AutoMation, ChengDu, China
this project also release in GitHub:
*/
#include "heltec.h"
#include "images.h"
#define BAND 868E6 //you can set band here directly,e.g. 868E6,915E6
#define txPower 14
#define frequency 868E6
#define spreadingFactor 7
#define signalBandwidth 125E3
#define codingRateDenominator 5
#define preambleLength 8
#define syncWord 0x34
unsigned int counter = 0;
String rssi = "RSSI --";
String packSize = "--";
String packet ;
void logo()
{
Heltec.display->clear();
Heltec.display->drawXbm(0,5,logo_width,logo_height,logo_bits);
Heltec.display->display();
}
void setup()
{
//WIFI Kit series V1 not support Vext control
Heltec.begin(true /*DisplayEnable Enable*/, true /*Heltec.Heltec.Heltec.LoRa Disable*/, true /*Serial Enable*/, true /*PABOOST Enable*/, BAND /*long BAND*/);
Heltec.display->init();
Heltec.display->flipScreenVertically();
Heltec.display->setFont(ArialMT_Plain_10);
logo();
delay(1500);
Heltec.display->clear();
Heltec.display->drawString(0, 0, "Heltec.LoRa Initial success!");
Heltec.display->display();
delay(1000);
LoRa.setFrequency(frequency);
LoRa.setSpreadingFactor(spreadingFactor);
LoRa.setSignalBandwidth(signalBandwidth);
LoRa.setCodingRate4(codingRateDenominator);
LoRa.setPreambleLength(preambleLength);
LoRa.setSyncWord(syncWord);
delay(1000);
}
void loop()
{
Heltec.display->clear();
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
Heltec.display->setFont(ArialMT_Plain_10);
Heltec.display->drawString(0, 0, "Sending packet: ");
Heltec.display->drawString(90, 0, String(counter));
Heltec.display->display();
// send packet
LoRa.beginPacket();
LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);
LoRa.print("hello ");
LoRa.print(counter);
LoRa.endPacket();
counter++;
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
The dragino is configured into custom method.
whereas if I consult the documentation, it could be 2 files like on this picture in the documentation :
Thank you very much for your help.