From 7207b474fdd63492fa45722769dc0bfcaaf4841f Mon Sep 17 00:00:00 2001 From: Nacho Date: Mon, 1 Dec 2025 23:44:56 +0000 Subject: [PATCH] Upload files to "/" --- README | 11 +++++++++++ main.cpp | 25 +++++++++++++++++++++++++ platformio.ini | 15 +++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 README create mode 100644 main.cpp create mode 100644 platformio.ini diff --git a/README b/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..469762b --- /dev/null +++ b/main.cpp @@ -0,0 +1,25 @@ +#include + +#define EXTERNAL_RX_PIN 16 // GPIO pin for the external device's TX +#define EXTERNAL_TX_PIN 17 // GPIO pin for the external device's RX +#define BAUD_RATE 115200 + +void setup() { + // Initialize communication with the computer (via USB-to-UART chip) + Serial.begin(BAUD_RATE); + + // Initialize communication with the external device (on designated GPIO pins) + Serial2.begin(BAUD_RATE, SERIAL_8N1, EXTERNAL_RX_PIN, EXTERNAL_TX_PIN); +} + +void loop() { + // Read from computer (Serial) and send to external device (Serial2) + if (Serial.available()) { + Serial2.write(Serial.read()); + } + + // Read from external device (Serial2) and send to computer (Serial) + if (Serial2.available()) { + Serial.write(Serial2.read()); + } +} \ No newline at end of file diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..8dd1b2d --- /dev/null +++ b/platformio.ini @@ -0,0 +1,15 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32dev] +platform = espressif32 +board = esp32dev +framework = arduino +monitor_speed = 115200 \ No newline at end of file