From 96d8a1406fc1663b5794efe7dcd598cb46b28f9c Mon Sep 17 00:00:00 2001 From: Lemonochrme Date: Mon, 2 Dec 2024 17:55:06 +0100 Subject: [PATCH] Using UART2 to avoid conflicts with UART0 used by logging and flashing. --- README.md | 2 ++ src/main.cpp | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a2e35fc..933e3be 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,5 @@ Response from "sys get ver" command : RN2483 1.0.5 Oct 31 2018 15:06:52 +DO NOT FORGET TO RESET THE RN2483 BY PULLING THE RST PIN ! + diff --git a/src/main.cpp b/src/main.cpp index ddff217..930f696 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,12 +4,15 @@ #include #include -#define SCREEN_WIDTH 128 // OLED display width, in pixels -#define SCREEN_HEIGHT 64 // OLED display height, in pixels +#define SCREEN_WIDTH 128 +#define SCREEN_HEIGHT 64 // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); +// RN2483Serial using RX2 and TX2 +HardwareSerial RN2483Serial(2); + void printSSD1306(String text) { display.clearDisplay(); display.setCursor(0, 0); @@ -38,14 +41,14 @@ void Init_SSD1306() { void test_RN2483A() { // Send a command to the RN2483A module - Serial.println("sys get ver"); + RN2483Serial.println("sys get ver"); // Wait for a response delay(1000); // Read the response from the RN2483A module - while (Serial.available()) { - String response = Serial.readString(); + while (RN2483Serial.available()) { + String response = RN2483Serial.readString(); printSSD1306("RN2483A Response:"); printSSD1306(response); } @@ -54,7 +57,7 @@ void test_RN2483A() { void setup() { // Initialize RN2483A Serial communication - Serial.begin(57600); + RN2483Serial.begin(57600); // Initialize SSD1306 Init_SSD1306();