Using UART2 to avoid conflicts with UART0 used by logging and flashing.

This commit is contained in:
Lemonochrme 2024-12-02 17:55:06 +01:00
parent 44342c223d
commit 96d8a1406f
2 changed files with 11 additions and 6 deletions

View file

@ -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 !

View file

@ -4,12 +4,15 @@
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#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();