#define LED1 15 #define LED2 12 void setup() { Serial.begin(115200); // Initialize serial communication Serial2.begin(115200); pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); } void loop() { if (Serial.available() > 0) { String data = Serial.readString(); Serial2.print(data); } if (Serial2.available()) { String receivedData = Serial2.readString(); // Receive data via UART Serial.println(receivedData); receivedData.trim(); if (receivedData.equals("LED1_ON")) { digitalWrite(LED1, HIGH); } if (receivedData.equals("LED1_OFF")) { digitalWrite(LED1, LOW); } else { if (receivedData.equals("LED2_ON")) { digitalWrite(LED2, HIGH); } if (receivedData.equals("LED2_OFF")) { digitalWrite(LED2, LOW); } else { Serial2.print("NO-INPUT"); } } }