Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: "Module Communication"
- - Source Code NOT compiled for: ESP32 DevKit V1
- - Source Code created on: 2025-05-01 08:01:58
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* add mmdvm hat to obsidian esp32 */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <SoftwareSerial.h> //https://github.com/plerup/espsoftwareserial
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF Software Serial *****/
- const uint8_t myHC05_HC05_mySerial_PIN_SERIAL_TX_D4 = 4;
- const uint8_t myHC05_HC05_mySerial_PIN_SERIAL_RX_D13 = 13;
- EspSoftwareSerial::UART myHC05_HC05_mySerial;
- // Define MMDVM hat related pins
- const uint8_t MMDVM_TX_PIN = 16; // Example pin for MMDVM TX
- const uint8_t MMDVM_RX_PIN = 17; // Example pin for MMDVM RX
- EspSoftwareSerial::UART mmdvmSerial; // Create a SoftwareSerial object for MMDVM
- void setup(void)
- {
- // Initialize Software Serial for HC05
- myHC05_HC05_mySerial.begin(9600, SWSERIAL_8N1, myHC05_HC05_mySerial_PIN_SERIAL_RX_D13, myHC05_HC05_mySerial_PIN_SERIAL_TX_D4, false);
- // Initialize Software Serial for MMDVM
- mmdvmSerial.begin(9600, SWSERIAL_8N1, MMDVM_RX_PIN, MMDVM_TX_PIN, false);
- }
- void loop(void)
- {
- // Main code for handling communication with HC05 and MMDVM
- if (myHC05_HC05_mySerial.available()) {
- // Read from HC05 and send to MMDVM
- char c = myHC05_HC05_mySerial.read();
- mmdvmSerial.write(c);
- }
- if (mmdvmSerial.available()) {
- // Read from MMDVM and send to HC05
- char c = mmdvmSerial.read();
- myHC05_HC05_mySerial.write(c);
- }
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement