#include <SoftwareSerial.h>
SoftwareSerial RS485Serial(10, 11); // RX (10), TX (11)

const int pinControl = 2; // Pin para controlar modo TX/RX

void setup() {
  Serial.begin(9600); // Iniciamos el monitor serie para ver los datos en la PC
  
  pinMode(pinControl, OUTPUT);
  digitalWrite(pinControl, LOW); // LOW = Modo de Recepción
  
  RS485Serial.begin(9600);
  
  Serial.println("Módulo receptor listo. Esperando mensajes...");
}

void loop() {
  // Si llega algún dato desde el bus RS485...
  if (RS485Serial.available()) {
    char letra = RS485Serial.read(); // Leemos el dato recibido
    Serial.print(letra);             // Lo mostramos en el Monitor Serie
  }
}