mirror of
https://github.com/MOSH-Insa-Toulouse/5ISS-2024-2025-MARIN--MULLER-BOUJON.git
synced 2025-06-08 22:10:49 +02:00
Using UART2 to avoid conflicts with UART0 used by logging and flashing.
This commit is contained in:
parent
44342c223d
commit
96d8a1406f
2 changed files with 11 additions and 6 deletions
|
@ -2,3 +2,5 @@
|
||||||
Response from "sys get ver" command :
|
Response from "sys get ver" command :
|
||||||
RN2483 1.0.5 Oct 31 2018 15:06:52
|
RN2483 1.0.5 Oct 31 2018 15:06:52
|
||||||
|
|
||||||
|
DO NOT FORGET TO RESET THE RN2483 BY PULLING THE RST PIN !
|
||||||
|
|
||||||
|
|
15
src/main.cpp
15
src/main.cpp
|
@ -4,12 +4,15 @@
|
||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
|
|
||||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
#define SCREEN_WIDTH 128
|
||||||
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
#define SCREEN_HEIGHT 64
|
||||||
|
|
||||||
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
|
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
|
||||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
|
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
|
||||||
|
|
||||||
|
// RN2483Serial using RX2 and TX2
|
||||||
|
HardwareSerial RN2483Serial(2);
|
||||||
|
|
||||||
void printSSD1306(String text) {
|
void printSSD1306(String text) {
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setCursor(0, 0);
|
display.setCursor(0, 0);
|
||||||
|
@ -38,14 +41,14 @@ void Init_SSD1306() {
|
||||||
|
|
||||||
void test_RN2483A() {
|
void test_RN2483A() {
|
||||||
// Send a command to the RN2483A module
|
// Send a command to the RN2483A module
|
||||||
Serial.println("sys get ver");
|
RN2483Serial.println("sys get ver");
|
||||||
|
|
||||||
// Wait for a response
|
// Wait for a response
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
// Read the response from the RN2483A module
|
// Read the response from the RN2483A module
|
||||||
while (Serial.available()) {
|
while (RN2483Serial.available()) {
|
||||||
String response = Serial.readString();
|
String response = RN2483Serial.readString();
|
||||||
printSSD1306("RN2483A Response:");
|
printSSD1306("RN2483A Response:");
|
||||||
printSSD1306(response);
|
printSSD1306(response);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +57,7 @@ void test_RN2483A() {
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Initialize RN2483A Serial communication
|
// Initialize RN2483A Serial communication
|
||||||
Serial.begin(57600);
|
RN2483Serial.begin(57600);
|
||||||
|
|
||||||
// Initialize SSD1306
|
// Initialize SSD1306
|
||||||
Init_SSD1306();
|
Init_SSD1306();
|
||||||
|
|
Loading…
Add table
Reference in a new issue