Hi, I have a problem, for now I just want to show a simple text on the OLED screen of my Wireless Stick board but nothing appears. The code on LoRa I think it does not affect because it works correctly.
Code Wireless Stick Board
// Heltec Wireless Stick Board
// Libraries for LoRa
#include <SPI.h>
#include <LoRa.h>
// Libraries for OLED
#include <Wire.h>
#include <SSD1306Wire.h>
// OLED related variables
#define OLED_ADDR 0x3c
#define OLED_SDA 4
#define OLED_SCL 15
// Define the pins used by the LoRa transceiver module
#define SCK 5 // GPIO5 -- SX1278 SCK
#define MISO 19 // GPIO19 -- SX1278 MISO
#define MOSI 27 // GPIO27 -- SX1278 MOSI
#define SS 18 // GPIO18 -- SX1278 CS
#define RST 14 // GPIO14 -- SX1278 RESET
#define DIO0 26 // GPIO26 -- SX1278 IRQ(Interrupt Request)
#define BAND 915E6 // 433E6 for Asia, 866E6 for Europe or 915E6 for North America
String LoRaData;
SSD1306Wire display(OLED_ADDR, OLED_SDA, OLED_SCL, GEOMETRY_64_32);
void displayText() {
display.init(); // Clear screen
display.setFont(ArialMT_Plain_16); // Format text
display.drawString(0, 0, "test"); // Add to buffer
display.display(); // Displays content in buffer
}
void setup() {
// Initialize Serial Monitor
Serial.begin(115200);
Serial.println("LoRa receiver");
// 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() {
int packetSize = LoRa.parsePacket();
if (packetSize) {
Serial.print("Receiver packet '");
while (LoRa.available()) {
LoRaData = LoRa.readString();
Serial.print(LoRaData);
}
int rssi = LoRa.packetRssi();
Serial.print("' with RSSI ");
Serial.print(rssi);
Serial.println("");
}
displayText();
}